Connecting Contact Form 7 to PostHog
Contact Form 7 is free, everywhere, and stores nothing by default — which is the whole problem. 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 Contact Form 7 submission 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
Contact Form 7 to PostHog: one distinct_id from page to form
To send Contact Form 7 leads to PostHog, use a named event, not autocaptured submits, which fire on failed validation and spam rejections. Capture it on the wpcf7mailsent DOM event, or server-side from the wpcf7_mail_sent hook with posthog.get_distinct_id() copied into a hidden field so it joins the session. Send form ID and topic, never the message body.
PostHog autocapture may already record submit events on a Contact Form 7 form, but a submit is not a sent message. It fires when validation fails and when CF7's spam check rejects the entry, so a funnel ending on autocaptured submits overstates conversion. Use a named event instead: capture it in the browser on the wpcf7mailsent DOM event, or server-side from the wpcf7_mail_sent hook, and drop the autocaptured submit from the funnel.
For the server-side route, read posthog.get_distinct_id() on the page and write it into a [hidden] field before submit. The hook then sends the event under the same distinct_id as the session, so it sits in the same funnel and next to the session replay of the visit. Without it the server event lands on a new anonymous person and the funnel shows a mysterious drop at the last step.
Identifying the visitor by the submitted email merges the anonymous history into a named person. Decide that deliberately: free-text CF7 fields such as your-message can contain anything, so send the event with form ID and topic only, never the message body, and check your replay masking covers the form inputs on a self-hosted instance.
Contact Form 7 → PostHog · what breaks
Why this join usually fails — Contact Form 7 → PostHog
- 01
The distinct_id never reaches Contact Form 7
There is no entries table to write to, so the identifier has to be captured into a hidden field and persisted by whatever you add for storage. Contact Form 7 submits over AJAX, so the page does not reload and anything expecting a navigation event never fires.
- 02
AJAX submission means no page load to hook
Setups that fire a conversion on thank-you-page load simply never fire. Setups that listen for the DOM event miss anyone whose script execution was blocked or deferred.
- 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.
Contact Form 7 → PostHog · the fix
What working looks like — Contact Form 7 → PostHog
The distinct_id on every submission
Conversions arriving in PostHog
The event lands on the person profile and becomes available in insights, funnels and session replay.
Reconciled against the source
Contact Form 7 → PostHog · architecture
How Contact Form 7 and PostHog actually connect
- 1
Contact Form 7 holds the truth
Out of the box Contact Form 7 emails the submission and keeps no record. Before any attribution work is meaningful, submissions have to be stored somewhere queryable. That is step one and it is not optional.
- 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 Contact Form 7 submission.
- 4
The event source decides reliability
Fire server-side from PHP. The browser-side wpcf7mailsent DOM event exists and is commonly used, but it depends on the visitor's browser executing correctly and on the AJAX response arriving — the server hook does not.
- 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.
Contact Form 7 → PostHog · normal or broken
Working vs. broken, side by side — Contact Form 7 → PostHog
Normal, not a fault
The distinct_id present on the submission
Sent from the wpcf7_mail_sent hook
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
There is no entries table to write to, so the identifier has to be captured into a hidden field and persisted by whatever you add for storage. Contact Form 7 submits over AJAX, so the page does not reload and anything expecting a navigation event never fires.
Sent from the browser
Setups that fire a conversion on thank-you-page load simply never fire. Setups that listen for the DOM event miss anyone whose script execution was blocked or deferred.
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
Contact Form 7 → PostHog · diagnose
Diagnostic order — Contact Form 7 → PostHog
- 01
Count submissions carrying the distinct_id
- 02
Follow one real conversion end to end
- 03
Confirm submissions are being stored at all
If the only record is an email inbox, there is nothing to reconcile and no way to prove any number. Fix storage before touching attribution.
- 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.
Contact Form 7 → PostHog · prove
How it gets proven — Contact Form 7 → PostHog
Source of truth
Whatever you configure to persist submissions — an entries plugin, or your own database table. By default there is nothing to reconcile against.
- The distinct_id confirmed present on a live submission.
- Purchase events reconciled per transaction against your billing system, with ingestion lag checked over the same window.
- Stored submissions confirmed to match the email record for the same period, before any attribution claim is made.
Contact Form 7 → PostHog · free audit
What we check in the free audit
- Count submissions carrying the distinct_id
- Follow one real conversion end to end
- Confirm submissions are being stored at all
- Check ingestion health and disk before debugging any missing event
- Read the match rate, not the success message
Checked against
Whatever you configure to persist submissions — an entries plugin, or your own database table. By default there is nothing to reconcile against.
Free30 minutesNo obligation
Contact Form 7 → PostHog · when not to buy
When you don't need this — Contact Form 7 → PostHog
- Measure identifier coverage yourself first — pull your last hundred submissions and count how many carry the distinct_id.
- If you are on Contact Form 7 and serious about attribution, moving to a form plugin that stores entries is often cheaper than working around the one that does not. We will say so rather than bill for the workaround.
- 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.
Contact Form 7 → PostHog · what we deliver
What gets built — Contact Form 7 → PostHog
Identifier capture into Contact Form 7
Hidden field populated from a first-party cookie, plus a storage layer so the submission and its identifier survive past the email. The wpcf7_before_send_mail hook is where both happen.
Event source: the wpcf7_mail_sent hook
Fire server-side from PHP. The browser-side wpcf7mailsent DOM event exists and is commonly used, but it depends on the visitor's browser executing correctly and on the AJAX response arriving — the server hook does not.
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
Nothing to reverse. Spam filtering before the send is the equivalent concern.
Written guarantee
95%+ tracking accuracy
Measured against Whatever you configure to persist submissions — an entries plugin, or your own database table. By default there is nothing to reconcile against.. Miss it and we keep working at no cost.
From $400 · See packages
FAQ
Contact Form 7 → PostHog questions, answered
Send a named event on the wpcf7mailsent DOM event, or from the wpcf7_mail_sent hook with the distinct_id captured in a hidden field, rather than relying on autocaptured submits.
Autocaptured submit events fire on invalid and spam submissions too. Build the funnel on an event that fires only when CF7 actually sends.
Almost always because the distinct_id never reached the Contact Form 7 submission. There is no entries table to write to, so the identifier has to be captured into a hidden field and persisted by whatever you add for storage. Contact Form 7 submits over AJAX, so the page does not reload and anything expecting a navigation event never fires. 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.
The wpcf7_mail_sent hook. Fire server-side from PHP. The browser-side wpcf7mailsent DOM event exists and is commonly used, but it depends on the visitor's browser executing correctly and on the AJAX response arriving — the server hook does not.
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 Contact Form 7 → PostHog
- Contact Form 7 → GA4Connecting Contact Form 7 to GA4
- Contact Form 7 → Google AdsConnecting Contact Form 7 to Google Ads
- Contact Form 7 → MetaConnecting Contact Form 7 to Meta Conversions API
RELATED GUIDES
Where Contact Form 7 → PostHog fits in the rest of your tracking
- Formstack → PostHogConnecting Formstack to PostHog
- Formidable Forms → PostHogConnecting Formidable Forms to PostHog
- Tally → PostHogConnecting Tally to PostHog
- Contact Form 7 → MatomoConnecting Contact Form 7 to Matomo
- Contact Form 7 → Adobe AnalyticsConnecting Contact Form 7 to Adobe Analytics
- Home servicesConversion tracking for home service businesses, measured in completed jobs
- Fluent Forms → PostHogConnecting Fluent Forms to PostHog
- Jotform → PostHogConnecting Jotform to PostHog
Free · 30 min
Get Contact Form 7 and PostHog joined properly
Free30 minutesNo obligation
