Wire real GA4 ID and Partytown analytics #8
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The .env.example shows
PUBLIC_GA4_ID=G-PLACEHOLDER— this means no analytics are actually being sent. Partytown is configured in vite.config.ts but there's no visible GA4 script tag in the layout or router-head.Current state: - Partytown lib is copied to dist on build- GA4 ID is placeholder- NoFixed in commit
6f3e104.root.tsx — Removed unconditional GA4 script tags. Partytown config + runtime stay here as shared infrastructure.
analytics-ga4.tsx (new) — Client-side component that checks consent cookie on mount. If
consent=1exists, dynamically injects gtag.js init + loader via Partytown (type="text/partytown"). Also listens forconsent:grantedcustom event from CookieConsent.cookie-consent.tsx — Dispatches
consent:grantedon window after settingconsent=1cookie.layout.tsx — Imports and renders
<AnalyticsGA4 />right after<CookieConsent />.Behavior:
Closes #8