All integrations

Analytics integration

Google Analytics 4 (GA4) on Shopify, made compliant

Google's behavioural-analytics product, mandatory since Universal Analytics was deprecated in July 2023.

Why consent applies to Google Analytics 4 (GA4)

GA4 sets a client identifier (`_ga`) and tracks behaviour across sessions. EU regulators classify this as non-essential — consent is required before the tracker fires for EU/UK/EEA visitors. CCPA also requires an opt-out for California visitors.

Cookies / scripts Google Analytics 4 (GA4) sets

  • _ga
  • _ga_<container>
  • _gid (legacy)

Step-by-step compliance setup

  1. 1

    Set Google Consent Mode v2 defaults to denied — before any tag loads

    Inline in the `<head>`, before the GA4 snippet, push a `gtag('consent', 'default', { ... 'denied' ... })` call. If GA4 fires before this, the first pageview is sent with implicit consent — exactly the leak GDPR Article 5(3) was written to stop.

  2. 2

    Block the GA4 script until consent

    GCM v2 alone tells GA4 to skip cookies; it does not stop the tag from loading. A proper consent banner intercepts `<script src="...gtag/js...">` creation via createElement override + MutationObserver, and only inserts it after the visitor accepts.

  3. 3

    Update GCM v2 signals on consent

    When the visitor accepts, call `gtag('consent', 'update', { analytics_storage: 'granted' })`. GA4 will start firing normal pageviews. Modeled conversions backfill any traffic from before the update.

  4. 4

    Honour Global Privacy Control for California visitors

    If `navigator.globalPrivacyControl === true`, treat the visitor as opted out — even before they interact with the banner. CPRA explicitly requires this since 2023.

How Consentico handles Google Analytics 4 (GA4)

Consentico sets GCM v2 defaults inline in `<head>` via the theme app extension, blocks the GA4 script load until consent, and updates signals on the visitor's choice — no GTM configuration required. Modeled conversions are preserved by sending cookieless pings during the denied state.

  • Default-deny before any tag fires
  • Three-layer script blocking (createElement + MutationObserver + content-type)
  • Audit-ready consent log

Related concepts

Related integrations

Block Google Analytics 4 (GA4) until consent — in five minutes.

Free for stores under 5,000 banner views per month. No code, no theme edits.