Skip to main content
Contentful → PostHogIntegration guide

Connecting Contentful to PostHog

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. PostHog can be self-hosted, which changes the calculus entirely: the data stays on infrastructure you control, and so does the responsibility for everything that goes wrong with it. The join between them succeeds or fails on one thing: whether the distinct_id reaches the front-end conversion, not a Contentful record before the conversion happens, because PostHog can only match a conversion it can tie back to a click it recognizes.

Free30 minutesNo obligation

Specific to this pair

Contentful and PostHog: entry IDs on events, one distinct_id

For PostHog on a Contentful stack, install posthog-js in the front end, fire pageviews on route changes, and attach entry ID and content type to each one. Send conversions from the backend through the capture API with the same distinct_id, which requires calling identify at signup or login. A Next.js rewrite can proxy ingestion through your domain.

PostHog fits a Contentful stack better than most destinations, because both are developer-run and the front end is already code you control. Install posthog-js in the Next.js or Nuxt app, make sure pageviews fire on client-side route changes rather than only on load, and attach the Contentful entry ID and content type as properties on every pageview. That turns PostHog funnels into a view of which content leads to signups, which is usually the question the content team is actually asking.

The conversion itself should come from the backend that records it, sent through the capture API with the same distinct_id the browser used. That means the frontend has to call identify when the person signs up or logs in, and the server has to know that ID when it records the purchase or plan change. Skip the identify call and every server event lands on a person PostHog has never seen browse anything.

PostHog documents running ingestion through a reverse proxy, and in a Next.js app that can be a rewrite rule, so the capture requests go to your own domain and are not blocked as a third-party tracker. Confirm the rewrite still works after framework upgrades; it is the kind of config that silently disappears.

Contentful → PostHog · what breaks

Why this join usually fails — Contentful → PostHog

  1. 01

    The distinct_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

    Self-hosting the analytics and the outage together

    The advantage of owning the pipeline is that nothing blocks it. The cost is that when the ingestion instance fills its disk on a Saturday, the events are gone and nobody is paged. Hosted tools fail differently and more visibly.

  4. 04

    Nothing reconciles afterwards

    PostHog shows events in the activity view within moments. On a self-hosted instance, check the ingestion lag as well — events that are queued are not events that are lost, and the two need different responses.

Contentful → PostHog · the fix

What working looks like — Contentful → PostHog

  • The distinct_id on every conversion

  • Conversions arriving in PostHog

    The event lands on the person profile and becomes available in insights, funnels and session replay.

  • Reconciled against the source

Contentful → PostHog · architecture

How Contentful and PostHog 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

    PostHog needs a click to match

    PostHog needs a distinct_id, an event name and its properties. Self-hosted instances additionally need the ingestion endpoint reachable and the project API key correct, which is a class of failure hosted tools do not have.

  3. 3

    The identifier is the bridge

    The distinct_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

    PostHog deduplicates on the event UUID where supplied. Without one, a retried batch duplicates, and on a self-hosted instance there is no vendor support desk to notice it for you.

Contentful → PostHog · normal or broken

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

Normal, not a fault

  • The distinct_id present on the conversion

  • Sent from your commerce, CRM or billing system

  • Deduplicated correctly

    PostHog deduplicates on the event UUID where supplied. Without one, a retried batch duplicates, and on a self-hosted instance there is no vendor support desk to notice it for you.

  • Reconciles with the source

Actually broken

  • The distinct_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 advantage of owning the pipeline is that nothing blocks it. The cost is that when the ingestion instance fills its disk on a Saturday, the events are gone and nobody is paged. Hosted tools fail differently and more visibly.

  • Nobody has reconciled it

Contentful → PostHog · diagnose

Diagnostic order — Contentful → PostHog

  1. 01

    Count conversions carrying the distinct_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 ingestion health and disk before debugging any missing event

    On self-hosted instances the answer is infrastructure far more often than it is instrumentation.

  5. 05

    Read the match rate, not the success message

    PostHog shows events in the activity view within moments. On a self-hosted instance, check the ingestion lag as well — events that are queued are not events that are lost, and the two need different responses.

Contentful → PostHog · prove

How it gets proven — Contentful → PostHog

Source of truth

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

  • The distinct_id confirmed present on a live conversion.
  • Purchase events reconciled per transaction against your billing system, with ingestion lag checked over the same window.
  • The conversion confirmed sourced from the commerce or CRM system rather than from anything in the content layer.

Contentful → PostHog · free audit

What we check in the free audit

  • Count conversions carrying the distinct_id
  • Follow one real conversion end to end
  • Establish which system holds the conversion before anything else
  • Check ingestion health and disk before debugging any missing event
  • 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 → PostHog · when not to buy

When you don't need this — Contentful → PostHog

  • Measure identifier coverage yourself first — pull your last hundred conversions and count how many carry the distinct_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.
  • If you have no reason to keep the data on your own infrastructure and no team to run it, the hosted product removes the only real downside of this one.

Contentful → PostHog · what we deliver

What gets built — Contentful → PostHog

  • 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 PostHog

    The PostHog capture API, posted server-side from your backend to your own instance or to PostHog Cloud.

  • 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 → PostHog questions, answered

Send the Contentful entry ID as an event property on pageviews from the front end, then build funnels from those pageviews to the server-sent conversion on the same distinct_id.

Free · 30 min

Get Contentful and PostHog joined properly

Free30 minutesNo obligation