Skip to content

Label the analytics dashboard sessions, because that is what it counts - #248

Merged
mmcky merged 1 commit into
mainfrom
analytics/sessions-not-users
Aug 7, 2026
Merged

Label the analytics dashboard sessions, because that is what it counts#248
mmcky merged 1 commit into
mainfrom
analytics/sessions-not-users

Conversation

@mmcky

@mmcky mmcky commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Companion to QuantEcon/website-dynamic#29. Together these complete QuantEcon/website-dynamic#9, which can be closed once this merges.

The dashboard's headline number has always been sessions presented as users. The pipeline requests Metric(name="sessions") from GA4 and stored the result in a column named users, which surfaced on this page as "Monthly Users", "Active Users by Country" and "Active Users (per capita) by Country". Every figure overstated the audience it claimed to measure — sessions typically run about 1.3–1.6× users on content sites.

Why this is safe to merge now

The pipeline change is already live. map_data.json and month_data.json currently publish sessions and sessions_per_capita alongside the original users and users_per_capita, with identical values, specifically so this page could be switched without a flag day.

Verified against the live published files rather than assumed:

Check Result
Fields this page now reads country, iso_alpha_3, month_formatted, sessions, sessions_per_capita
Fields the live JSON provides all of the above, plus the legacy users, users_per_capita
Missing fields that would break the page none
Map z-values vs what the page renders today identical
Month y-values vs today identical

So the numbers on the page do not move. Only the labels change.

What changed

Four field reads — row.usersrow.sessions in the country map and the monthly line chart, and row.users_per_capitarow.sessions_per_capita in the per-capita map — plus the chart titles, axis titles, colourbar titles, hover templates and the three navigation links.

A short note above the charts carries the caveat QuantEcon/website-dynamic#9 asks be stated next to the chart rather than left implicit: these are visits rather than people, and sessions are the figure reported precisely because they can be summed across the eight lecture series while user counts cannot — one reader visiting three series would be counted three times, and free GA4 offers no cross-property deduplication. It also notes that the Chinese, Persian and French translations are counted under their English series, since they reuse the same measurement IDs.

Section anchor ids are deliberately unchanged (#country-users, #monthly-users, #country-per-capita). Renaming them would break any existing deep link for no visible benefit, so only the link text moved.

One visible change to the per-capita map

sessions_per_capita is null for a country whose population is unknown, where the old users_per_capita was 0. Plotly leaves nulls uncoloured instead of placing them at the bottom of the ramp — which is what previously made Taiwan, on 1,587 sessions, render identically to a country with no readers at all.

That was fixed upstream in QuantEcon/website-dynamic#12; in the currently published data no country is left without a denominator, so nothing renders grey today. The behaviour matters for whatever GA4 reports next.

After this merges

The users and users_per_capita fields stay in the published JSON for one more cycle, then come out in a one-line change upstream. Nothing further is needed here.

🤖 Generated with Claude Code

The dashboard's headline number has always been sessions presented as
users. The pipeline requests Metric(name='sessions') from GA4 and stored
the result in a column named 'users', which surfaced here as 'Monthly
Users', 'Active Users by Country' and 'Active Users (per capita) by
Country'. Every figure on the page overstated the audience it claimed to
measure -- sessions typically run about 1.3-1.6x users on content sites.

The pipeline side landed in QuantEcon/website-dynamic#29 and is already
published: map_data.json and month_data.json now carry sessions and
sessions_per_capita alongside the original users fields, with identical
values, so this change can be made without a flag day. See
QuantEcon/website-dynamic#9 for the full reasoning.

This switches the four field reads to the new names and relabels the
charts and navigation. Rendered values are unchanged -- verified against
the live published JSON, where sessions equals users for every row.

Also adds the cross-property caveat that QuantEcon/website-dynamic#9
asks be written down next to the chart: these are visits rather than
people, and sessions are reported precisely because they can be summed
across the eight lecture series while user counts cannot.

The per-capita chart now reads sessions_per_capita, which is null for
countries with no known population rather than 0. Plotly leaves those
uncoloured instead of placing them at the bottom of the colour ramp,
which is what made Taiwan look like it had no readers.

Section anchor ids are left alone so existing deep links keep working.
Copilot AI lite review requested due to automatic review settings August 7, 2026 06:01
@netlify

netlify Bot commented Aug 7, 2026

Copy link
Copy Markdown

Deploy Preview for grand-swan-ca5201 ready!

Name Link
🔨 Latest commit 0c3bbd3
🔍 Latest deploy log https://app.netlify.com/projects/grand-swan-ca5201/deploys/6a7574d0bb8b2d0008bb5b2e
😎 Deploy Preview https://deploy-preview-248--grand-swan-ca5201.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the QuantEcon analytics dashboard page to correctly present GA4 sessions (visits) rather than labeling the same underlying metric as users. It aligns the page with the already-live data pipeline outputs (sessions and sessions_per_capita) while keeping section anchors stable to avoid breaking existing deep links.

Changes:

  • Switch JSON field reads from users / users_per_capita to sessions / sessions_per_capita for the country map, monthly series, and per-capita map.
  • Update chart titles, axis labels, colorbar titles, hover templates, and navigation link text to say “Sessions”.
  • Add an explanatory note clarifying what “sessions” means and why it’s the appropriate aggregate across multiple sites/series.

@mmcky
mmcky merged commit ff2a9b9 into main Aug 7, 2026
6 checks passed
@mmcky
mmcky deleted the analytics/sessions-not-users branch August 7, 2026 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants