Skip to content

Local sites produce no analytics data in the dashboard — investigate and add coverage #299

Description

@DominicBM

Summary

Usage on DPLA's ten local hub sites is entirely invisible to the Analytics Dashboard. No item views, click-throughs, or sessions from any local site are attributed to any hub or contributor in the dashboard.

How Local Sites Are Built

Each local site (aviation.dp.la, texas.dp.la, etc.) is a separate deployment of the dpla-frontend codebase, built with NEXT_PUBLIC_SITE_ENV=local and a site-specific NEXT_PUBLIC_LOCAL_ID. GA4 tracking is initialized in pages/_app.js via a single NEXT_PUBLIC_GA_TRACKING_ID environment variable.

The current tracking IDs configured per site (from .github/workflows/local-*.yml) are:

Site GA_TRACKING_ID
aviation.dp.la (empty — no tracking)
florida.dp.la G-6PYKFL6JZF
illinois.dp.la G-9ZE47RTKH5
njde.dp.la (empty — no tracking)
nwdh.dp.la G-64QXSW0Q5K
oklahoma.dp.la (empty — no tracking)
plains2peaks.dp.la G-PZK6XWKZDN
texas.dp.la (empty — no tracking)
vermont.dp.la (empty — no tracking)
wisconsin.dp.la G-6FP9Q9EVYZ

Five sites have no GA4 tracking whatsoever. For the five that do have a tracking ID, the events go to a hub-owned GA4 property, not to the DPLA dashboard's GA4 property (G-1P5QWL64H0, property 369185054). The dashboard only queries the DPLA property — so none of these sites' events are visible in the dashboard regardless.

Impact

  • Item views, click-throughs, sessions, and search terms generated on any local site are not counted in the hub's or any contributor's dashboard stats.
  • Partners who use local sites as their primary discovery interface see none of that usage in the dashboard.
  • This is especially significant for Texas (texas.dp.la has no tracking at all) and aviation.dp.la (see below).

The Aviation Case

Aviation (aviation.dp.la, "Cleared for Takeoff: Explore Commercial Aviation") is a multi-hub aggregator: it surfaces items from many contributing institutions across different DPLA hubs, filtered by the tag aviation. It has hasBrowseByPartner: true, meaning the site surfaces content from multiple partners under one roof. GA_TRACKING_ID is empty — zero tracking — so all views and click-throughs on aviation.dp.la are invisible to every hub and contributor whose content appears there.

Even if tracking were added, attribution requires care: a View Item event on aviation.dp.la for an item belonging to, say, a Texas contributor should be counted in that contributor's stats, not in some "aviation" bucket. The dpla-frontend already includes partner and contributor in GA4 event payloads — so the attribution would work correctly as long as events go to the right property.

Proposed Fix

The cleanest solution is dual-stream tracking: configure each local site to send events to both the DPLA GA4 property AND the hub's own property (if they have one). GA4 supports multiple gtag("config", ...) calls on the same page.

In pages/_app.js, when NEXT_PUBLIC_SITE_ENV === "local", add a second config call for the DPLA property:

// Always send to DPLA's property on local sites
gtag("config", DPLA_GA_PROPERTY_ID, { send_page_view: false });

Page views and events would then be attributed to both properties. The dashboard would pick up local site usage automatically because partner and contributor are already in every event payload.

Alternatives:

  • GA4 data streams: Add a data stream for each local site domain within the DPLA GA4 property — no code change, but each domain needs to be explicitly authorized in GA4 Admin.
  • GA4 Measurement Protocol forwarding: Post events server-side to the DPLA property — more reliable but more complex.

Action Items

  1. Decide on dual-stream vs. data-streams approach.
  2. Add DPLA GA4 property tracking to all local sites (even those with empty GA_TRACKING_ID today).
  3. Ensure aviation.dp.la events are attributed to the correct hub/contributor by verifying partner/contributor fields in the GA4 event payload are populated correctly for cross-hub items.
  4. Verify in the dashboard that local site events appear in the correct hub and contributor rows after the change.
  5. Consider whether to also surface local site traffic as a separate breakdown in the dashboard (e.g., "dp.la traffic" vs. "local site traffic") for hubs that want that detail.

/cc @megannp4

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingenhancementNew feature or request

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions