Skip to main content
Contact Form 7 → MatomoIntegration guide

Connecting Contact Form 7 to Matomo

Contact Form 7 is free, everywhere, and stores nothing by default — which is the whole problem. Matomo can be self-hosted with no third party in the chain, which makes it the one analytics destination where the data genuinely never leaves infrastructure you control. The join between them succeeds or fails on one thing: whether the first-party visitor ID reaches the Contact Form 7 submission before the conversion happens, because Matomo 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 Matomo: a goal on the AJAX event

Contact Form 7 never loads a goal URL, so define a manually triggered Matomo goal fired on the wpcf7mailsent DOM event, with the form ID as a custom dimension. Server goals from wpcf7_mail_sent through the HTTP Tracking API need Matomo's visitor ID in a hidden field. Allow one conversion per visit to prevent double counting.

Matomo goals are often defined as visiting a URL, and Contact Form 7 never loads one; it posts over AJAX and shows its message in place. Define the goal as manually triggered and fire it from the wpcf7mailsent DOM event through the JavaScript tracker or Matomo Tag Manager, passing the CF7 form ID as a custom dimension so a site with five forms does not report them as one goal.

For a server-side path, the HTTP Tracking API can record the goal from the wpcf7_mail_sent hook, but it only joins the visit if the visitor ID from Matomo's first-party cookie was captured into a [hidden] field before submit. Without it, Matomo records a new visitor with no referrer and the lead shows up as direct. A lead has no order ID to deduplicate on, so use the goal setting that allows one conversion per visit; it stops a double-clicked submit or a browser and server hit from counting twice.

When Matomo is installed through the WordPress plugin, the tracking data sits in the same WordPress database as the site and the form. A traffic spike that slows that database slows form submissions and analytics together, and a full database loses both. If stored CF7 submissions and Matomo goal counts disagree after a busy week, check ingestion and database health before blaming the tag.

Contact Form 7 → Matomo · what breaks

Why this join usually fails — Contact Form 7 → Matomo

  1. 01

    The first-party visitor 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.

  2. 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.

  3. 03

    Owning the pipeline means owning the outage

    The advantage is that nothing blocks it. The cost is that when the tracking database fills or falls behind on a weekend, the data is gone and no vendor is paging anyone. Hosted tools fail more visibly.

  4. 04

    Nothing reconciles afterwards

    Matomo exposes raw visit logs, so you can inspect the actual hit rather than an aggregate. Check the log, and check ingestion lag alongside it.

Contact Form 7 → Matomo · the fix

What working looks like — Contact Form 7 → Matomo

  • The first-party visitor ID on every submission

  • Conversions arriving in Matomo

    The event lands in your own database and is queryable directly, including the raw log, which most analytics products do not expose.

  • Reconciled against the source

Contact Form 7 → Matomo · architecture

How Contact Form 7 and Matomo actually connect

  1. 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. 2

    Matomo needs a click to match

    The site ID, the visitor identifier and the event or ecommerce order. Self-hosted instances additionally need the tracker endpoint reachable and the database keeping up, which hosted tools do not fail at.

  3. 3

    The identifier is the bridge

    The first-party visitor ID, captured at the visit and carried into the Contact Form 7 submission.

  4. 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. 5

    Deduplication at the destination

    Matomo deduplicates ecommerce orders on order ID. Without one, a refreshed confirmation page records a second order.

Contact Form 7 → Matomo · normal or broken

Working vs. broken, side by side — Contact Form 7 → Matomo

Normal, not a fault

  • The first-party visitor ID present on the submission

  • Sent from the wpcf7_mail_sent hook

  • Deduplicated correctly

    Matomo deduplicates ecommerce orders on order ID. Without one, a refreshed confirmation page records a second order.

  • Reconciles with the source

Actually broken

  • The first-party visitor 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 is that nothing blocks it. The cost is that when the tracking database fills or falls behind on a weekend, the data is gone and no vendor is paging anyone. Hosted tools fail more visibly.

  • Nobody has reconciled it

Contact Form 7 → Matomo · diagnose

Diagnostic order — Contact Form 7 → Matomo

  1. 01

    Count submissions carrying the first-party visitor ID

  2. 02

    Follow one real conversion end to end

  3. 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.

  4. 04

    Check tracker reachability and database lag before debugging any tag

    On self-hosted analytics the answer is infrastructure more often than instrumentation.

  5. 05

    Read the match rate, not the success message

    Matomo exposes raw visit logs, so you can inspect the actual hit rather than an aggregate. Check the log, and check ingestion lag alongside it.

Contact Form 7 → Matomo · prove

How it gets proven — Contact Form 7 → Matomo

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 first-party visitor ID confirmed present on a live submission.
  • Orders reconciled against the Matomo ecommerce log with order-ID deduplication verified.
  • Stored submissions confirmed to match the email record for the same period, before any attribution claim is made.

Contact Form 7 → Matomo · free audit

What we check in the free audit

  • Count submissions carrying the first-party visitor ID
  • Follow one real conversion end to end
  • Confirm submissions are being stored at all
  • Check tracker reachability and database lag before debugging any tag
  • 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.

Get my free conversion tracking audit

Free30 minutesNo obligation

Contact Form 7 → Matomo · when not to buy

When you don't need this — Contact Form 7 → Matomo

  • Measure identifier coverage yourself first — pull your last hundred submissions and count how many carry the first-party visitor 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 privacy or ownership requirement and no team to run it, a hosted product removes the only real cost of this one.

Contact Form 7 → Matomo · what we deliver

What gets built — Contact Form 7 → Matomo

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

    The Matomo HTTP Tracking API, posted server-side from your order system.

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

Get my free conversion tracking audit

From $400 · See packages

FAQ

Contact Form 7 → Matomo questions, answered

Create a manually triggered goal and fire it on the wpcf7mailsent DOM event, since there is no thank-you page URL to match on.

Free · 30 min

Get Contact Form 7 and Matomo joined properly

Free30 minutesNo obligation