Skip to main content
Contentful → GA4Integration guide

Connecting Contentful to GA4

Contentful is headless content only — it has no checkout, no orders and no customers, which is the single most important thing to establish before anyone quotes for work. GA4 is where the business goes to understand what happened, which makes an unattributed conversion there expensive in decisions rather than in ad spend. The join between them succeeds or fails on one thing: whether the GA4 client_id reaches the front-end conversion, not a Contentful record before the conversion happens, because GA4 can only match a conversion it can tie back to a click it recognizes.

Free30 minutesNo obligation

Specific to this pair

Contentful sites and GA4: fix the front end, not the CMS

GA4 problems on Contentful sites come from the front end: fire page_view on router navigation without doubling enhanced measurement. Have the Next.js API route read the _ga cookie and attach client_id and session_id to the lead or order, then send purchase or generate_lead from commerce or CRM via Measurement Protocol. Entry ID and content type become custom dimensions.

If GA4 numbers look wrong on a Contentful-powered site, the cause is almost always the front-end app that renders the entries. Client-side route changes in a Next.js or Nuxt front end do not reload the page, so GA4 records one page_view per visit unless the router fires page views on navigation, or enhanced measurement's browser-history setting is on without a manual tag doubling it. Open DebugView and click between three pages: one view per visit and two views per click are both bugs.

For conversions, send GA4 events from the system that holds the order or lead, with a client_id the front end captured. A Next.js API route or server action that submits the lead or creates the checkout is the natural place: it can read the _ga cookie on the request and attach client_id and session_id to the record. The commerce or CRM system then sends purchase or generate_lead through Measurement Protocol, and the browser stops sending that event so GA4 does not count it twice.

Contentful's real contribution to GA4 is content dimensions. Entry ID and content type can be pushed as parameters on page_view and registered as custom dimensions, which shows whether case studies, guides or landing entries lead to conversions. That is reporting, not conversion tracking. If your team has an analytics app installed in the Contentful web app, check what it does; an editor-side app that displays traffic per entry sends nothing from your site.

Contentful → GA4 · what breaks

Why this join usually fails — Contentful → GA4

  1. 01

    The GA4 client_id never reaches Contentful

    Because Contentful is headless, the front end is a separate application — usually Next.js, Nuxt or similar — and that application is where client-side routing, caching and identifier capture all actually happen. Attributing a tracking problem to Contentful is nearly always a misdiagnosis.

  2. 02

    Blaming the CMS for a front-end problem

    Headless setups fail at the front end — client-side routing that fires one pageview per session, an identifier lost on a route change — and the CMS gets blamed. Contentful is not in that path at all.

  3. 03

    Everything lands under (direct)/(none)

    The classic Measurement Protocol symptom, and it always means the same thing: the client_id was missing or wrong, so GA4 had no session to attach the event to and invented a new user.

  4. 04

    Nothing reconciles afterwards

    GA4 DebugView shows events arriving with their parameters, and Realtime confirms the user and session they attached to. Neither tells you whether you are double-counting — for that, compare GA4's conversion count against the source system's record for the same window.

Contentful → GA4 · the fix

What working looks like — Contentful → GA4

  • The GA4 client_id on every conversion

  • Conversions arriving in GA4

    Conversions appear in GA4 attributed to the original session's source and medium, so acquisition reporting reflects what actually drove revenue.

  • Reconciled against the source

Contentful → GA4 · architecture

How Contentful and GA4 actually connect

  1. 1

    Contentful holds the truth

    Contentful stores content and serves it via API. The commercial record lives in your commerce platform, your CRM or your billing system, and that is where measurement belongs.

  2. 2

    GA4 needs a click to match

    GA4 needs the client_id to attach a server event to the user and session that produced the click. Without it there is no attribution to inherit and the event is orphaned.

  3. 3

    The identifier is the bridge

    The GA4 client_id, captured at the visit and carried into the front-end conversion, not a Contentful record.

  4. 4

    The event source decides reliability

    Send from the system that holds the money. Contentful contributes the content layer and nothing to the conversion.

  5. 5

    Deduplication at the destination

    GA4 has no built-in deduplication for Measurement Protocol. If the browser also sends the event, it counts twice. The only reliable approach is to decide per event which side sends it, and enforce that decision — GA4 will not protect you from your own duplicates.

Contentful → GA4 · normal or broken

Working vs. broken, side by side — Contentful → GA4

Normal, not a fault

  • The GA4 client_id present on the conversion

  • Sent from your commerce, CRM or billing system

  • Deduplicated correctly

    GA4 has no built-in deduplication for Measurement Protocol. If the browser also sends the event, it counts twice. The only reliable approach is to decide per event which side sends it, and enforce that decision — GA4 will not protect you from your own duplicates.

  • Reconciles with the source

Actually broken

  • The GA4 client_id missing on most records

    Because Contentful is headless, the front end is a separate application — usually Next.js, Nuxt or similar — and that application is where client-side routing, caching and identifier capture all actually happen. Attributing a tracking problem to Contentful is nearly always a misdiagnosis.

  • Sent from the browser

    Headless setups fail at the front end — client-side routing that fires one pageview per session, an identifier lost on a route change — and the CMS gets blamed. Contentful is not in that path at all.

  • Counted twice, or not at all

    The classic Measurement Protocol symptom, and it always means the same thing: the client_id was missing or wrong, so GA4 had no session to attach the event to and invented a new user.

  • Nobody has reconciled it

Contentful → GA4 · diagnose

Diagnostic order — Contentful → GA4

  1. 01

    Count conversions carrying the GA4 client_id

  2. 02

    Follow one real conversion end to end

  3. 03

    Establish which system holds the conversion before anything else

    In a headless stack it is never the CMS, and starting there wastes the engagement.

  4. 04

    Check whether server events carry a session and a source

    In GA4 Realtime or DebugView, find the event and look at its session and traffic source. A brand-new user with no source on every server event is the missing-client_id signature.

  5. 05

    Read the match rate, not the success message

    GA4 DebugView shows events arriving with their parameters, and Realtime confirms the user and session they attached to. Neither tells you whether you are double-counting — for that, compare GA4's conversion count against the source system's record for the same window.

Contentful → GA4 · prove

How it gets proven — Contentful → GA4

Source of truth

Whatever system takes the money — Contentful holds none of it.

  • The GA4 client_id confirmed present on a live conversion.
  • Server events confirmed in DebugView attaching to an existing session with the original traffic source intact.
  • The conversion confirmed sourced from the commerce or CRM system rather than from anything in the content layer.

Contentful → GA4 · free audit

What we check in the free audit

  • Count conversions carrying the GA4 client_id
  • Follow one real conversion end to end
  • Establish which system holds the conversion before anything else
  • Check whether server events carry a session and a source
  • Read the match rate, not the success message

Checked against

Whatever system takes the money — Contentful holds none of it.

Get my free conversion tracking audit

Free30 minutesNo obligation

Contentful → GA4 · when not to buy

When you don't need this — Contentful → GA4

  • Measure identifier coverage yourself first — pull your last hundred conversions and count how many carry the GA4 client_id.
  • There is no Contentful-specific tracking build. The work is in your front-end framework and your commerce system, and we would say so rather than bill for the CMS.
  • GA4 is reporting, not bidding. If your problem is ad platform optimization, fix the ad platform destination first — GA4 will not change what any campaign does.

Contentful → GA4 · what we deliver

What gets built — Contentful → GA4

  • Identifier capture into Contentful

    Capture and persist the identifier in the front-end application, server-side, and carry it into whichever system records the conversion.

  • Event source: your commerce, CRM or billing system

    Send from the system that holds the money. Contentful contributes the content layer and nothing to the conversion.

  • Dispatch to GA4

    Measurement Protocol events with the client_id, session_id and the correct measurement ID and API secret, sent server-side.

  • Reversals where they exist

    Handled wherever the money lives.

Written guarantee

95%+ tracking accuracy

Measured against Whatever system takes the money — Contentful holds none of it.. Miss it and we keep working at no cost.

Get my free conversion tracking audit

From $400 · See packages

FAQ

Contentful → GA4 questions, answered

Your front end routes client-side, so the page never reloads. Fire page_view on each route change, or enable enhanced measurement's browser-history page views, but not both.

Free · 30 min

Get Contentful and GA4 joined properly

Free30 minutesNo obligation