Overview
The system tracks where users were immediately before viewing an event page and aggregates those views into three sources:| Source | Meaning |
|---|---|
| Org Page | User came from an org profile (/org/...) or club dashboard |
| Explore | User came from the events dashboard / explore page |
| Direct | Empty referrer, external URL, or unrecognized path |
Why SPA Referrer Tracking?
document.referrer does not update on client-side navigation. When a user navigates from /events-dashboard to /event/123, the browser’s referrer still points to the previous external page (or is empty). The app therefore tracks the previous pathname on every route change and injects it into context.referrer for all analytics events.
Frontend: Referrer Context
File:Meridian/frontend/src/utils/referrerContext.js
Flow
- Layout calls
updateReferrerOnNavigation(pathname)on every route change (via React Router). - The previous pathname is stored in session storage as the “referrer” for the next page.
- The analytics SDK uses
getReferrerPath() || document.referrerwhen building events, socontext.referrerreflects where the user came from.
Overlay Override
When content is shown in an overlay (e.g. org profile over/events-dashboard), the URL does not change. Clicks from the overlay would otherwise get the wrong referrer. To fix this:
- On overlay mount: Call
setReferrerOverride('/org/OrgName')so the next navigation uses that path as the referrer. - On overlay close (without navigation): Call
clearReferrerOverride()so the override is not reused incorrectly.
OrgDisplay.jsx sets the override when the org profile overlay opens and clears it when the user clicks Back.
Backend: Source Aggregation
File:Meridian/backend/routes/eventAnalyticsRoutes.js
The event analytics endpoint (GET /event-analytics/event/:eventId) aggregates event_view events by derived source:
- If
properties.sourceis explicitly set and valid (org_page,explore,direct), use it. - Otherwise, derive from
context.referrer:- Contains
org/orclub-dashboard→org_page - Contains
events-dashboard→explore - Else →
direct
- Contains
platform.referrerSources:
Per-Source Conversion Rates
Registrations are attributed to the source that brought the user to the event page. For eachevent_registration, the backend finds the most recent event_view before the registration from the same user (anonymous_id or user_id) and uses that view’s source.
Response fields:
platform.referrerRegistrations—{ org_page, explore, direct, email }— registrations attributed to each sourceplatform.qrReferrerSources— each item now includesregistrations— registrations attributed to each QR code
registrations / views for each source (e.g. “50% of QR scans led to registration”).
UI: Sources Section
The Event Analytics tab displays the Sources breakdown in a ProportionalBarList component: each source (Direct, Explore, Org Page) is shown with a count and a proportional grey bar. Only sources with count > 0 are shown; rows are sorted by count descending.Adding New Sources
To add a new source:- Backend: Extend the
$switchbranches in the referrer aggregation (eventAnalyticsRoutes.js) with a new path-matching condition. - Frontend: Add the new source key to the
sourceItemsarray inEventAnalyticsDetail.jsxwith an appropriate label and icon. - Documentation: Update this page and Analytics Collected Events.
Related pages
Analytics collected events
Event names, properties, and referrer attribution across the product.
Platform analytics
Ingestion pipeline, envelope schema, and
POST /v1/events contract.Atlas event analytics
Organizer dashboards that consume aggregated views and sources.
Event dashboard
Where Sources and funnel views surface in the Atlas UI.