Connecting OneTrust to PostHog
OneTrust sits upstream of every tag on the site, which makes it the single system most able to change your conversion volume overnight without anybody touching a tag. 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 OneTrust consent 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
OneTrust and PostHog: opt-out capturing and server-side events
Start PostHog opted out where policy requires opt-in, with in-memory persistence, and wire OneTrust's callback to opt_in_capturing and opt_out_capturing. Ask counsel whether session replay needs a stricter category. Store consent as a person property and have the backend check it before server-side captures. On withdrawal, stop capture and, if required, verify deletion removed events on self-hosted instances.
PostHog's JavaScript library has consent controls built in: it can start opted out by default, keep persistence in memory so no cookie is set, and opt in or out on command. Wire OneTrust's callback to call opt_in_capturing when the analytics category is granted and opt_out_capturing when it is withdrawn, and start the library opted out where your policy requires opt-in. Session replay is a heavier use than event capture; ask whether counsel wants it under a stricter category.
The trap specific to PostHog is that product teams often send most events from the backend, where the browser's opt-out does nothing. A server-side capture call with the user's distinct_id records them regardless of what they chose in the banner. Store consent as a person property and have the backend check it before capturing anything beyond what your policy treats as necessary product telemetry.
Self-hosting changes who holds the data, not whether a visitor's choice applies. When consent is withdrawn, stop capture and, if your policy calls for deletion, delete the person in PostHog. On a self-hosted instance it is your job to verify that the deletion removed the person's events and not only the profile, since no vendor is checking for you.
OneTrust → PostHog · what breaks
Why this join usually fails — OneTrust → PostHog
- 01
The distinct_id never reaches OneTrust
The identifier can only be captured after consent is given, so a visitor who consents on the second page has already lost the parameter from the first.
- 02
A governance change that looks like broken tracking
A privacy team tightens a banner on a Tuesday and a fifth of conversions disappear. The marketing team spends a week debugging tags that are working exactly as configured, because nobody connects the two systems.
- 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.
- 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.
OneTrust → PostHog · the fix
What working looks like — OneTrust → PostHog
The distinct_id on every consent record
Conversions arriving in PostHog
The event lands on the person profile and becomes available in insights, funnels and session replay.
Reconciled against the source
OneTrust → PostHog · architecture
How OneTrust and PostHog actually connect
- 1
OneTrust holds the truth
Consent is not a tracking detail, it is the gate. A conversion from a visitor who declined cannot lawfully be sent to an ad platform, and the share who decline is the ceiling on everything you report.
- 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
The identifier is the bridge
The distinct_id, captured at the visit and carried into the OneTrust consent record.
- 4
The event source decides reliability
Send only conversions where consent for advertising purposes was actually granted, and report the unconsented share as a stated number rather than a gap.
- 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.
OneTrust → PostHog · normal or broken
Working vs. broken, side by side — OneTrust → PostHog
Normal, not a fault
The distinct_id present on the consent record
Sent from your order system, gated on the consent record
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
The identifier can only be captured after consent is given, so a visitor who consents on the second page has already lost the parameter from the first.
Sent from the browser
A privacy team tightens a banner on a Tuesday and a fifth of conversions disappear. The marketing team spends a week debugging tags that are working exactly as configured, because nobody connects the two systems.
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
OneTrust → PostHog · diagnose
Diagnostic order — OneTrust → PostHog
- 01
Count consent records carrying the distinct_id
- 02
Follow one real conversion end to end
- 03
Correlate conversion drops against the consent change log first
Before touching a tag. In governed environments this explains the drop more often than any technical fault does.
- 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.
- 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.
OneTrust → PostHog · prove
How it gets proven — OneTrust → PostHog
Source of truth
Your order or CRM system, with the consent state at the time of the event recorded alongside.
- The distinct_id confirmed present on a live consent record.
- Purchase events reconciled per transaction against your billing system, with ingestion lag checked over the same window.
- Consented conversions reconciled against imported figures, with the consent rate stated explicitly in the report.
OneTrust → PostHog · free audit
What we check in the free audit
- Count consent records carrying the distinct_id
- Follow one real conversion end to end
- Correlate conversion drops against the consent change log first
- Check ingestion health and disk before debugging any missing event
- Read the match rate, not the success message
Checked against
Your order or CRM system, with the consent state at the time of the event recorded alongside.
Free30 minutesNo obligation
OneTrust → PostHog · when not to buy
When you don't need this — OneTrust → PostHog
- Measure identifier coverage yourself first — pull your last hundred consent records and count how many carry the distinct_id.
- If your consent rate is very low, improving the banner experience will do more for your reporting than any tracking build — and that is a design and legal conversation, not a tagging one.
- 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.
OneTrust → PostHog · what we deliver
What gets built — OneTrust → PostHog
Identifier capture into OneTrust
Capture into a pending buffer on landing and only persist and dispatch once consent is recorded — never the reverse, and never 'capture now, ask later'.
Event source: your order system, gated on the consent record
Send only conversions where consent for advertising purposes was actually granted, and report the unconsented share as a stated number rather than a gap.
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
Withdrawal of consent should stop future sends and, where the platform supports it, trigger a deletion request.
Written guarantee
95%+ tracking accuracy
Measured against Your order or CRM system, with the consent state at the time of the event recorded alongside.. Miss it and we keep working at no cost.
From $400 · See packages
FAQ
OneTrust → PostHog questions, answered
Start PostHog opted out where you need opt-in, then call opt_in_capturing from OneTrust's callback when the analytics category is granted and opt_out_capturing when it is withdrawn.
No. The banner only controls the browser. Backend capture calls need their own consent check, typically against a person property you keep in sync.
Almost always because the distinct_id never reached the OneTrust consent record. The identifier can only be captured after consent is given, so a visitor who consents on the second page has already lost the parameter from the first. Measure coverage before debugging the dispatch.
PostHog identifies by distinct_id with an alias call to merge anonymous and identified users. On a self-hosted instance you also control the ingestion endpoint, which means the identifier survives ad blockers that would kill a third-party pixel — one of the few genuine technical advantages available to a first-party setup.
Your order system, gated on the consent record. Send only conversions where consent for advertising purposes was actually granted, and report the unconsented share as a stated number rather than a gap.
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.
More on OneTrust → PostHog
- Stripe → PostHogConnecting Stripe to PostHog
- PayPal → PostHogConnecting PayPal to PostHog
- Shopify → PostHogConnecting Shopify to PostHog
RELATED GUIDES
Where OneTrust → PostHog fits in the rest of your tracking
- iubenda → PostHogConnecting iubenda to PostHog
- Usercentrics → PostHogConnecting Usercentrics to PostHog
- Complianz → PostHogConnecting Complianz to PostHog
- OneTrust → Adobe AnalyticsConnecting OneTrust to Adobe Analytics
- OneTrust → MatomoConnecting OneTrust to Matomo
- Financial servicesConversion tracking for financial services, built for the compliance review
- CookieYes → PostHogConnecting CookieYes to PostHog
- Termly → PostHogConnecting Termly to PostHog
Free · 30 min
Get OneTrust and PostHog joined properly
Free30 minutesNo obligation
