Skip to content

fix: use gtag API for GA4 event tracking#118

Merged
johnshift merged 2 commits intodevfrom
fix/analytics-event-track
Mar 8, 2026
Merged

fix: use gtag API for GA4 event tracking#118
johnshift merged 2 commits intodevfrom
fix/analytics-event-track

Conversation

@johnshift
Copy link
Copy Markdown
Collaborator

Summary

  • Fixed all GA4 custom events being silently dropped. trackEvent was pushing plain objects to dataLayer (GTM format), but the app uses gtag.js which only processes Arguments objects from gtag() calls.
  • Changed window.dataLayer?.push({event, ...params}) to window.gtag?.('event', event, params) — the correct gtag.js API.
  • Affects all tracked events: apply clicks, filter usage, search queries, job card clicks, pagination, login, profile actions, etc.

Test plan

  • Verify apply_button_clicked event fires in GA4 DebugView when clicking Apply on a job
  • Verify other events (e.g. filter_applied, job_card_clicked) also appear in GA4 DebugView

trackEvent was pushing plain objects to dataLayer (GTM format),
but the app uses gtag.js which only processes Arguments objects
from gtag() calls. All custom GA events were silently dropped.
@github-actions github-actions bot added the fix Bug fix label Mar 8, 2026
@johnshift johnshift merged commit 246a3e5 into dev Mar 8, 2026
7 checks passed
@johnshift johnshift deleted the fix/analytics-event-track branch March 8, 2026 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant