Connecting Optimizely to PostHog
Optimizely deliberately shows different people different experiences, which means every conversion figure your ad platform reports is an average across variants it knows nothing about. 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 Optimizely variant assignment 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
Optimizely decisions in PostHog: pick one assignment system
First decide whether Optimizely or PostHog's own flags assign variants. If Optimizely does, send each decision once per user per experiment as a PostHog event and person properties. With Feature Experimentation, use the same user ID as PostHog's distinct_id; with Optimizely Web, record the bucketing cookie before identify. Put UUIDs on server-sent orders.
PostHog has its own feature flags and experiments, so the first decision for this pair is which tool assigns variants. Running both on the same flow gives you two independent randomizations and results that interact. If Optimizely assigns, PostHog becomes the analysis layer: send each Optimizely decision as an event with experiment and variation as properties, and set them as person properties so funnels and retention can be broken down by variant.
The join that makes this clean is the user identifier. With Optimizely Feature Experimentation you pass a user ID to the SDK; use the same value as PostHog's distinct_id, and the decision and every later event land on one person without any aliasing. With Optimizely Web the bucketing ID is a browser cookie, so record that cookie value as a property on PostHog's anonymous user before identify merges it with the signed-in person.
Send the decision once per user per experiment, at the moment the variant is actually shown, not every time the SDK is asked. Feature Experimentation can evaluate a flag many times per session; logging every evaluation to PostHog inflates exposure counts and breaks any exposure-based funnel. Include a UUID on server-sent orders so a retried batch does not duplicate them.
Optimizely → PostHog · what breaks
Why this join usually fails — Optimizely → PostHog
- 01
The distinct_id never reaches Optimizely
Client-side experiments can flicker and can delay rendering, which loses landing-page identifier capture on slow connections — a bias that falls unevenly across variants.
- 02
An experiment silently confounding every campaign result
A test that moves conversion rate by fifteen percent will move every campaign's measured performance by some fraction of that, and the media team will attribute it to bidding, creative or seasonality. Anything but the test.
- 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.
Optimizely → PostHog · the fix
What working looks like — Optimizely → PostHog
The distinct_id on every assignment
Conversions arriving in PostHog
The event lands on the person profile and becomes available in insights, funnels and session replay.
Reconciled against the source
Optimizely → PostHog · architecture
How Optimizely and PostHog actually connect
- 1
Optimizely holds the truth
The variant is the missing dimension. Without it, a campaign's performance is confounded by an experiment nobody told the media team about, and both teams will draw confident, wrong conclusions.
- 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 Optimizely variant assignment.
- 4
The event source decides reliability
Send purchases with the variant as a custom dimension, so campaign performance can be read per variant rather than blended.
- 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.
Optimizely → PostHog · normal or broken
Working vs. broken, side by side — Optimizely → PostHog
Normal, not a fault
The distinct_id present on the assignment
Sent from your order system with variant attached
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
Client-side experiments can flicker and can delay rendering, which loses landing-page identifier capture on slow connections — a bias that falls unevenly across variants.
Sent from the browser
A test that moves conversion rate by fifteen percent will move every campaign's measured performance by some fraction of that, and the media team will attribute it to bidding, creative or seasonality. Anything but the test.
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
Optimizely → PostHog · diagnose
Diagnostic order — Optimizely → PostHog
- 01
Count assignments carrying the distinct_id
- 02
Follow one real conversion end to end
- 03
Check for running experiments before diagnosing a performance change
First question, not last. It costs one minute and explains a surprising share of unexplained movements.
- 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.
Optimizely → PostHog · prove
How it gets proven — Optimizely → PostHog
Source of truth
Your order system, joined to the variant each customer was assigned.
- The distinct_id confirmed present on a live assignment.
- Purchase events reconciled per transaction against your billing system, with ingestion lag checked over the same window.
- Orders reconciled per variant against imported conversions over the full experiment window.
Optimizely → PostHog · free audit
What we check in the free audit
- Count assignments carrying the distinct_id
- Follow one real conversion end to end
- Check for running experiments before diagnosing a performance change
- Check ingestion health and disk before debugging any missing event
- Read the match rate, not the success message
Checked against
Your order system, joined to the variant each customer was assigned.
Free30 minutesNo obligation
Optimizely → PostHog · when not to buy
When you don't need this — Optimizely → PostHog
- Measure identifier coverage yourself first — pull your last hundred assignments and count how many carry the distinct_id.
- If you are not running experiments on pages in the paid funnel, there is no confound and nothing to integrate.
- 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.
Optimizely → PostHog · what we deliver
What gets built — Optimizely → PostHog
Identifier capture into Optimizely
Capture the identifier before the experiment framework initializes, and pass the variant assignment as a dimension alongside it.
Event source: your order system with variant attached
Send purchases with the variant as a custom dimension, so campaign performance can be read per variant rather than blended.
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
Refunds reverse and should retain the variant dimension.
Written guarantee
95%+ tracking accuracy
Measured against Your order system, joined to the variant each customer was assigned.. Miss it and we keep working at no cost.
From $400 · See packages
FAQ
Optimizely → PostHog questions, answered
One or the other per flow. If Optimizely already assigns variants, keep it as the assignment system and use PostHog to analyze funnels and retention by the Optimizely variation.
Use the same ID for the Optimizely SDK user and PostHog's distinct_id. For client-side Optimizely Web, store the Optimizely visitor cookie as a property before the PostHog identify call.
Almost always because the distinct_id never reached the Optimizely variant assignment. Client-side experiments can flicker and can delay rendering, which loses landing-page identifier capture on slow connections — a bias that falls unevenly across variants. 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 with variant attached. Send purchases with the variant as a custom dimension, so campaign performance can be read per variant rather than blended.
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 Optimizely → PostHog
- Optimizely → Google AdsConnecting Optimizely to Google Ads
- Optimizely → MetaConnecting Optimizely to Meta Conversions API
- Optimizely → GA4Connecting Optimizely to GA4
RELATED GUIDES
Where Optimizely → PostHog fits in the rest of your tracking
- mParticle → PostHogConnecting mParticle to PostHog
- Tealium → PostHogConnecting Tealium to PostHog
- Dynamic Yield → PostHogConnecting Dynamic Yield to PostHog
- Optimizely → AmplitudeConnecting Optimizely to Amplitude
- Optimizely → MatomoConnecting Optimizely to Matomo
- EcommerceConversion tracking for ecommerce brands, measured against your orders
- RudderStack → PostHogConnecting RudderStack to PostHog
- VWO → PostHogConnecting VWO to PostHog
Free · 30 min
Get Optimizely and PostHog joined properly
Free30 minutesNo obligation
