diff --git a/packages/ui/src/components/google-tag-manager.tsx b/packages/ui/src/components/google-tag-manager.tsx index d70c52876a..b98bad5ce8 100644 --- a/packages/ui/src/components/google-tag-manager.tsx +++ b/packages/ui/src/components/google-tag-manager.tsx @@ -1,18 +1,26 @@ /** * Consent-gated Google Tag Manager loader. * - * Renders the GTM bootstrap as an inert `type="text/plain"` script tagged for - * CookieYes' analytics category. CookieYes activates it only after the visitor - * grants analytics consent — mirroring the pattern already used across the apps - * for Tolt and the previous GTM container. Before activation nothing loads, so - * no Google network calls happen without consent (GDPR/ePrivacy compliant). + * Split into two parts on purpose: * - * The same container (one per the prisma.io domain) is used by every zone; each - * zone passes its `section` so all hits carry a `site_section` dimension and can - * be segmented (website vs blog vs docs) in GA4. + * 1. An inline bootstrap that always runs. It only initialises `dataLayer` + * (a plain in-memory array) and pushes the page section + GTM start event. + * This sets no cookies and makes no network requests, so it is safe to run + * before consent. + * 2. The GTM library itself, loaded as an EXTERNAL `src` script tagged for + * CookieYes' analytics category. CookieYes only reliably re-activates + * external `src` scripts after consent — an inline `type="text/plain"` GTM + * bootstrap is left inert and never executes, so it must NOT be used here. + * This mirrors the working external-`src` pattern used for Tolt/PromptWatch. + * See https://www.cookieyes.com/documentation/implement-prior-consent-using-cookieyes/ * - * Note: no `