Skip to content

Investigate restoring website and API use timelines, or remove from nav #295

Description

@DominicBM

Current State

Two nav items — "DPLA website use timelines" and "API use timelines" — exist in the data menu for every hub and contributor, but both pages show only:

"This feature is no longer available due to new security protocols. It may be restored in the future."

The actual chart content in both templates (_timeline_website.html.erb, _timeline_api.html.erb) is wrapped in <% if false %> and never rendered. The TimelinesController still exists and responds to requests, but it only assigns date/hub variables — it renders nothing useful.

What These Features Did

Both timelines used the Google Analytics JavaScript Embed API — a now-discontinued client-side library that allowed embedding interactive GA charts directly in a web page using an OAuth access token passed from the server.

DPLA website use timelines (/hubs/:hub/timelines/website) showed four time-series charts for the selected hub or contributor:

  • Item views over time
  • Click-throughs over time
  • Users over time
  • Sessions over time

API use timelines (/hubs/:hub/timelines/api) showed:

  • API item metadata views over time (available from May 2018 per the template note)

Both charts were rendered client-side using the GA Embed API, reading from UA profiles configured in Settings.google_analytics.frontend_profile_id and api_profile_id. The "new security protocols" message predates the UA shutdown — OAuth token passing to the browser was likely flagged as a security concern before UA was deprecated.

Why They Cannot Be Directly Restored

The GA Embed API was a Universal Analytics feature and has no GA4 equivalent. GA4 does not provide a client-side charting library. Restoring equivalent functionality would require:

  1. Calling the GA4 Data API server-side with a DATE dimension to get time-series data by day/month
  2. Serializing that data into the page (JSON in a <script> tag or a dedicated JSON endpoint)
  3. Rendering charts client-side using a JS library (Chart.js, Recharts, D3, etc.)

This is meaningful engineering work, not a configuration fix.

Relationship to Existing Issues

The "website use timelines" charts are conceptually the same feature requested in #293 (dynamically generated line charts using in-page JS). If #293 is implemented, it should subsume and replace the timelines nav items rather than treating them as separate work.

The "API use timelines" are blocked by the same underlying issue as #294 (API item views) — api.dp.la has no GA4 tracking, so there is no data source regardless of charting approach.

Proposed Resolution

Short term: If neither timeline can be populated with real data now, both nav items should be removed. A page that renders only "this feature is no longer available" is worse UX than no nav item. Files to clean up: _timeline_website.html.erb, _timeline_api.html.erb, timelines_controller.rb, render_website_timelines_link, render_api_timelines_link in data_menu_helper.rb, and the corresponding routes.

Long term: Implement line charts as part of #293, which covers the website-use timeline use case. Revisit API timelines only after #294 is resolved and api.dp.la has a GA4 data source.

/cc @megannp4

Metadata

Metadata

Assignees

No one assigned

    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