Skip to content

docs: add GA4 tracking for HEP CTAs - #13840

Open
kacperlukawski wants to merge 2 commits into
mainfrom
docs/hep-ga4-tracking
Open

kacperlukawski wants to merge 2 commits into
mainfrom
docs/hep-ga4-tracking

Conversation

@kacperlukawski

Copy link
Copy Markdown
Member

Related Issues

  • None

Proposed Changes:

The Haystack Enterprise Platform (HEP) CTAs across the docs can't be told apart in GA4 today: almost all link to https://www.deepset.ai/haystack-platform with the same text. This adds placement-level tracking via the GTM dataLayer (docs site only; GTM/GA4 configuration is separate).

  • New client module src/clientModules/hepTracking.js pushes:
    • docs_page_context on every route change (docs_section, docs_version, hep_available, page_path)
    • hep_cta_click on clicks to deepset.ai-owned hosts, with cta_location (navbar, footer, callout_*, HEP pages, Enterprise Components intro, inline) and cta_type. The push is synchronous and never blocks navigation.
    • hep_cta_view (≥50% visible for ≥1s, once per location per page view, navbar skipped)
    • hep_badge_click / hep_badge_view for the component-page badge
  • PlatformBadge gets data-cta="badge" and data-component; the name is passed from DocItem/Content.
  • Small local plugin plugins/hepTrackingDataPlugin.js exposes each page's top-level sidebar category and hep_available frontmatter through global data, so docs_section works without the sidebar being rendered (mobile).

No MDX files are edited.

How did you test it?

npm run build in docs-website/ passes. Checked the generated global data for docs_section / hep_available values. Runtime events have not yet been verified in GTM Preview / GA4 DebugView.

Notes for the reviewer

  • Unmapped admonitions linking to deepset hosts get cta_location: callout.
  • Middle-clicks are also tracked (auxclick).

Checklist

🤖 Generated with Claude Code

…rm CTAs

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
haystack-docs Ready Ready Preview Nov 20, 2026 4:11pm UTC

Request Review

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@kacperlukawski
kacperlukawski marked this pull request as ready for review November 20, 2026 16:13
@kacperlukawski
kacperlukawski requested a review from a team as a code owner November 20, 2026 16:13
@kacperlukawski
kacperlukawski requested review from bogdankostic and removed request for a team November 20, 2026 16:13

This branch was successfully deployed

1 active deployment
Preview — 45dec309 Deployed Nov 20, 2026 by vercel[bot]
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.

1 participant