Skip to content

feat(format-selector): GA4 ai_format_action events#7215

Merged
jstirnaman merged 10 commits into
masterfrom
chore-llm-request-metrics
May 14, 2026
Merged

feat(format-selector): GA4 ai_format_action events#7215
jstirnaman merged 10 commits into
masterfrom
chore-llm-request-metrics

Conversation

@jstirnaman
Copy link
Copy Markdown
Contributor

@jstirnaman jstirnaman commented May 13, 2026

Summary

Wires ai_format_action GA4 events into the format-selector dropdown. Six action values cover all five dropdown options plus the failure path:

data-option event action Emit point
copy-page copy_page_md handleCopyPage success
copy-section copy_section_md handleCopySection success
open-chatgpt open_chatgpt option click (intent)
open-claude open_claude option click (intent)
connect-mcp-docs connect_mcp option click (intent)
(n/a) copy_failed catch path with action_target

Copy actions emit on outcome (success or catch); external-link actions emit on click since the browser handles navigation after the handler returns. product is derived via the existing getProductKeyFromPath() in assets/js/utils/product-mappings.ts.

Part A of #7210. Part B (S3 access logs → InfluxDB 3 pipeline for *.md/*.txt request metrics) ships on a separate branch.

End-to-end verified in Brave with Tag Assistant against the live GA4 endpoint on /influxdb3/clustered/: a Copy section click on a page without .md artifacts produced an ai_format_action hit with action=copy_failed, action_target=copy_section_md, page_type=branch, product=influxdb3_clustered.

Test plan

  • Cypress GA4 suite in cypress/e2e/content/llm-format-selector.cy.js passes (all 6 GA4 tests)
  • Manual browser verification on a leaf page and a branch page via Google Tag Assistant
  • No double-emit on copy success (intent map intentionally excludes copy-page / copy-section)
  • Type-check (yarn build:ts) clean

…ectors

copyToClipboard previously swallowed rejections internally, so handleCopyPage's
catch never fired and copy_failed events never emitted. Rethrow so the caller's
catch sees the failure.

Cypress tests: switch to .format-selector__button (the bare button selector
matches dropdown buttons too) and stub gtag after page load so GA4's own
gtag.js can't overwrite the stub.
Adds the missing connect_mcp Cypress test (the MCP option renders on
/influxdb3/core/* per layouts/partials/article/format-selector.html, so
the prior 'skip if not configured' note was unjustified).

PLAN.md: every run-e2e-specs.js invocation now includes --no-mapping;
without it the script exits with 'No file paths provided.' Adds a
fallback snippet using a manually-started Hugo + npx cypress for when
port 1315 is already occupied.
@jstirnaman jstirnaman requested a review from a team as a code owner May 13, 2026 20:51
@jstirnaman jstirnaman requested review from sanderson and removed request for a team May 13, 2026 20:51
Cleanup ephemeral planning doc before merge. Work summary
and test plan live in the PR description (#7215); follow-up
tasks live in the tracking issue (#7210).
@jstirnaman jstirnaman merged commit 8016a3e into master May 14, 2026
20 checks passed
@jstirnaman jstirnaman deleted the chore-llm-request-metrics branch May 14, 2026 16:28
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.

LLM format selector: analytics + consolidation follow-ups for Markdown autodiscovery

1 participant