Skip to main content
Statamic → MixpanelIntegration guide

Connecting Statamic to Mixpanel

Statamic is a flat-file CMS on Laravel, usually chosen by agencies for content sites where commerce is bolted on rather than central. Mixpanel is a product analytics tool, not an ad platform, which means it has no attribution model of its own and will faithfully report whatever event schema you give it — including a bad one. The join between them succeeds or fails on one thing: whether the distinct_id reaches the Statamic or Laravel order record before the conversion happens, because Mixpanel can only match a conversion it can tie back to a click it recognizes.

Free30 minutesNo obligation

Specific to this pair

Statamic conversions in Mixpanel on the same distinct_id

Keep content engagement in Mixpanel's browser library and send the form submission or order server-side from a Laravel listener, carrying the browser's distinct_id written into a hidden field by JavaScript, never the cached template. Use the submission or order ID as $insert_id. Send the server event only after the submission saves, and track browser submit clicks separately.

Mixpanel's browser library runs fine on a statically cached Statamic page, so content engagement can stay client-side. The conversion, a form submission or order, should be sent server-side from a Laravel listener, because that is the only place that knows it really succeeded. The two halves only join if the server event carries the distinct_id the browser already has.

Write that distinct_id into a hidden form field with JavaScript when the form renders, and read it in the listener. Do not print it from the template: on a fully cached page the HTML is generated once and served to everyone, so a baked-in ID would merge every visitor into one profile. Use the submission or order ID as $insert_id so a retried request does not count twice.

The Statamic-specific failure is a funnel that looks broken when the form is. Cached pages need their CSRF token refreshed, and when that is misconfigured the browser records a submit click while the server rejects the post. Send the server event only after the submission is saved, and add the browser submit click as a separate event; the gap between them is your real form failure rate.

Statamic → Mixpanel · what breaks

Why this join usually fails — Statamic → Mixpanel

  1. 01

    The distinct_id never reaches Statamic

    Statamic's static caching serves pre-rendered files with no PHP execution at all, which means anything expecting server-side rendering per request simply does not run.

  2. 02

    Static caching bypassing PHP entirely

    Statamic's full static caching serves a file from disk. No PHP runs, so nothing dynamic happens — and this is invisible because the page looks perfect.

  3. 03

    One event schema, two teams, no agreement

    Marketing names an event Purchase, the product team names it purchase_completed, and both are sent. Mixpanel treats them as unrelated, every funnel silently splits, and two teams spend a quarter arguing about which number is right when both are.

  4. 04

    Nothing reconciles afterwards

    Mixpanel shows events in the live view within moments. Check that the distinct_id matches the signed-in user rather than a lingering anonymous ID, because that is the failure that quietly breaks every cross-signup funnel.

Statamic → Mixpanel · the fix

What working looks like — Statamic → Mixpanel

  • The distinct_id on every order

  • Conversions arriving in Mixpanel

    The event lands on the user profile and becomes available in funnels, retention and cohort analysis.

  • Reconciled against the source

Statamic → Mixpanel · architecture

How Statamic and Mixpanel actually connect

  1. 1

    Statamic holds the truth

    Because Statamic sits on Laravel, the commercial record is usually a database table your developers defined. That is the source of truth and it is fully under your control.

  2. 2

    Mixpanel needs a click to match

    Mixpanel needs a distinct_id, an event name and its properties. Events without a distinct_id are rejected; events with the wrong one land on a stranger's profile.

  3. 3

    The identifier is the bridge

    The distinct_id, captured at the visit and carried into the Statamic or Laravel order record.

  4. 4

    The event source decides reliability

    Fire from the application event. Static caching means the template that rendered the page may never have executed anything.

  5. 5

    Deduplication at the destination

    Mixpanel deduplicates on $insert_id within a time window. Without it, a retried server request creates a second event, and because Mixpanel is where product decisions get made, that inflation ends up in a roadmap rather than in an ad report.

Statamic → Mixpanel · normal or broken

Working vs. broken, side by side — Statamic → Mixpanel

Normal, not a fault

  • The distinct_id present on the order

  • Sent from your Laravel application's order event

  • Deduplicated correctly

    Mixpanel deduplicates on $insert_id within a time window. Without it, a retried server request creates a second event, and because Mixpanel is where product decisions get made, that inflation ends up in a roadmap rather than in an ad report.

  • Reconciles with the source

Actually broken

  • The distinct_id missing on most records

    Statamic's static caching serves pre-rendered files with no PHP execution at all, which means anything expecting server-side rendering per request simply does not run.

  • Sent from the browser

    Statamic's full static caching serves a file from disk. No PHP runs, so nothing dynamic happens — and this is invisible because the page looks perfect.

  • Counted twice, or not at all

    Marketing names an event Purchase, the product team names it purchase_completed, and both are sent. Mixpanel treats them as unrelated, every funnel silently splits, and two teams spend a quarter arguing about which number is right when both are.

  • Nobody has reconciled it

Statamic → Mixpanel · diagnose

Diagnostic order — Statamic → Mixpanel

  1. 01

    Count orders carrying the distinct_id

  2. 02

    Follow one real conversion end to end

  3. 03

    Check whether full static caching is enabled

    If it is, any per-request logic in a template is not running and never was.

  4. 04

    List every event name in the project and look for near-duplicates

    Case differences, tense differences and synonyms are the usual finding, and they are cheap to fix before a year of data is built on them.

  5. 05

    Read the match rate, not the success message

    Mixpanel shows events in the live view within moments. Check that the distinct_id matches the signed-in user rather than a lingering anonymous ID, because that is the failure that quietly breaks every cross-signup funnel.

Statamic → Mixpanel · prove

How it gets proven — Statamic → Mixpanel

Source of truth

Whatever your Laravel application persists — Statamic's flat files hold content, not transactions.

  • The distinct_id confirmed present on a live order.
  • Purchase events reconciled per transaction against your billing system, with identity aliasing verified across the signup boundary.
  • Order data confirmed persisted on a purchase made while full static caching was active.

Statamic → Mixpanel · free audit

What we check in the free audit

  • Count orders carrying the distinct_id
  • Follow one real conversion end to end
  • Check whether full static caching is enabled
  • List every event name in the project and look for near-duplicates
  • Read the match rate, not the success message

Checked against

Whatever your Laravel application persists — Statamic's flat files hold content, not transactions.

Get my free conversion tracking audit

Free30 minutesNo obligation

Statamic → Mixpanel · when not to buy

When you don't need this — Statamic → Mixpanel

  • Measure identifier coverage yourself first — pull your last hundred orders and count how many carry the distinct_id.
  • If commerce lives in a separate system entirely, work there — Statamic is the content layer.
  • If you already have the same events in a warehouse and nobody is running product analysis on them, adding Mixpanel adds a second source of truth rather than an answer.

Statamic → Mixpanel · what we deliver

What gets built — Statamic → Mixpanel

  • Identifier capture into Statamic

    Capture the identifier and persist it through a Laravel event listener into your own order table, entirely outside the static cache path.

  • Event source: your Laravel application's order event

    Fire from the application event. Static caching means the template that rendered the page may never have executed anything.

  • Dispatch to Mixpanel

    The Mixpanel ingestion API, posted server-side from your backend with the distinct_id and event properties.

  • Reversals where they exist

    Whatever your application defines as a refund.

Written guarantee

95%+ tracking accuracy

Measured against Whatever your Laravel application persists — Statamic's flat files hold content, not transactions.. Miss it and we keep working at no cost.

Get my free conversion tracking audit

From $400 · See packages

FAQ

Statamic → Mixpanel questions, answered

From a Laravel listener after the submission is saved, using a distinct_id the Mixpanel browser library wrote into a hidden field, and the submission ID as $insert_id.

Free · 30 min

Get Statamic and Mixpanel joined properly

Free30 minutesNo obligation