Skip to content

Track citation copy clicks before clipboard write#303

Merged
ewlarson merged 1 commit into
developfrom
feature/fix-citation-copy-gtm-events
Jun 19, 2026
Merged

Track citation copy clicks before clipboard write#303
ewlarson merged 1 commit into
developfrom
feature/fix-citation-copy-gtm-events

Conversation

@ewlarson

Copy link
Copy Markdown
Contributor

Summary

  • Push cite_copy and cite_url GTM dataLayer events before attempting clipboard writes.
  • Keep internal analytics batching and copied UI state behind successful clipboard writes.
  • Add regression coverage for clipboard-denied copy clicks still emitting GTM events.

Why

Live testing on /resources/00000157c02249ae81ad7ee1300d3586_0 showed both copy clicks can fail with NotAllowedError: Failed to execute 'writeText' on 'Clipboard': Write permission denied. Because the GTM push was after writeText, those clicks never reached GTM Preview.

Validation

  • npm test -- --run src/__tests__/components/resource/CitationTable.test.tsx
  • npx eslint src/components/resource/CitationTable.tsx src/__tests__/components/resource/CitationTable.test.tsx
  • npx prettier --check src/components/resource/CitationTable.tsx src/__tests__/components/resource/CitationTable.test.tsx
  • git diff --check

Note: ESLint/Prettier emitted the local pyenv rehash warning but exited successfully.

@ewlarson ewlarson merged commit 22db8f1 into develop Jun 19, 2026
12 checks passed
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