Skip to main content
Statamic → AmplitudeIntegration guide

Connecting Statamic to Amplitude

Statamic is a flat-file CMS on Laravel, usually chosen by agencies for content sites where commerce is bolted on rather than central. Amplitude is built around behavioural cohorts, which makes the identity resolution and the event taxonomy load-bearing in a way they never are for an ad pixel. The join between them succeeds or fails on one thing: whether the user ID and device ID pair reaches the Statamic or Laravel order record before the conversion happens, because Amplitude can only match a conversion it can tie back to a click it recognizes.

Free30 minutesNo obligation

Specific to this pair

Statamic site events in Amplitude, server-side where it counts

Leave browsing to Amplitude's browser SDK and send the conversion, a Statamic form submission or order, from a Laravel listener. Write the SDK's device ID into a hidden field with JavaScript at runtime, never in cached HTML, and send it as device_id plus any user ID. Refresh CSRF tokens on cached forms. Only orders should carry price and quantity fields.

On a Statamic content site, Amplitude is mostly about reading behavior: which articles lead to enquiries, which sections people come back to. The browser SDK handles that fine, static cache or not. The server-side piece is the conversion itself, a form submission or order, sent from a Laravel listener so it is recorded even if the browser blocks Amplitude.

That server event has to land on the same device as the browsing. Have the browser SDK's device ID written into a hidden field when the form renders, read it in the listener, and send it as device_id with the event; if the visitor has an account, add the user ID too. On a statically cached page the field must be filled by JavaScript at runtime, because the cached HTML is the same for every visitor and anything baked in at render would be someone else's ID.

Watch the Statamic-specific CSRF problem at the same time. Forms on fully cached pages need the token refreshed, and if submissions fail, there is no conversion to send. If the site has commerce, send orders with Amplitude's price and quantity fields populated; a lead with no value should not carry revenue fields at all.

Statamic → Amplitude · what breaks

Why this join usually fails — Statamic → Amplitude

  1. 01

    The user ID and device ID pair 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

    Revenue events that carry no revenue

    Amplitude will happily accept a purchase event with no price field. The event count looks correct, the funnel looks correct, and the revenue reporting stays at zero — which people usually discover a quarter later when someone asks what a cohort is worth.

  4. 04

    Nothing reconciles afterwards

    Amplitude shows the event in the user's activity stream with its properties expanded. Read the properties, because an event that arrives without its revenue fields still looks like a success.

Statamic → Amplitude · the fix

What working looks like — Statamic → Amplitude

  • The user ID and device ID pair on every order

  • Conversions arriving in Amplitude

    The event lands on the user, joins their behavioural history, and becomes available for cohorts, funnels and retention.

  • Reconciled against the source

Statamic → Amplitude · architecture

How Statamic and Amplitude 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

    Amplitude needs a click to match

    Amplitude needs a device or user identifier, an event type and its properties. Revenue events need the price and quantity fields specifically, or the revenue reporting stays empty while events flow normally.

  3. 3

    The identifier is the bridge

    The user ID and device ID pair, 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

    Amplitude deduplicates on insert_id. Omit it and a retried batch is counted twice, which shows up as a phantom spike that someone will eventually build a hypothesis on.

Statamic → Amplitude · normal or broken

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

Normal, not a fault

  • The user ID and device ID pair present on the order

  • Sent from your Laravel application's order event

  • Deduplicated correctly

    Amplitude deduplicates on insert_id. Omit it and a retried batch is counted twice, which shows up as a phantom spike that someone will eventually build a hypothesis on.

  • Reconciles with the source

Actually broken

  • The user ID and device ID pair 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

    Amplitude will happily accept a purchase event with no price field. The event count looks correct, the funnel looks correct, and the revenue reporting stays at zero — which people usually discover a quarter later when someone asks what a cohort is worth.

  • Nobody has reconciled it

Statamic → Amplitude · diagnose

Diagnostic order — Statamic → Amplitude

  1. 01

    Count orders carrying the user ID and device ID pair

  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

    Check a purchase event for the price and quantity fields specifically

    Not whether the event arrived — whether the revenue fields are populated, in the exact names Amplitude expects.

  5. 05

    Read the match rate, not the success message

    Amplitude shows the event in the user's activity stream with its properties expanded. Read the properties, because an event that arrives without its revenue fields still looks like a success.

Statamic → Amplitude · prove

How it gets proven — Statamic → Amplitude

Source of truth

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

  • The user ID and device ID pair confirmed present on a live order.
  • Revenue reconciled per transaction against your billing system, with identity merge behaviour verified across signup.
  • Order data confirmed persisted on a purchase made while full static caching was active.

Statamic → Amplitude · free audit

What we check in the free audit

  • Count orders carrying the user ID and device ID pair
  • Follow one real conversion end to end
  • Check whether full static caching is enabled
  • Check a purchase event for the price and quantity fields specifically
  • 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 → Amplitude · when not to buy

When you don't need this — Statamic → Amplitude

  • Measure identifier coverage yourself first — pull your last hundred orders and count how many carry the user ID and device ID pair.
  • If commerce lives in a separate system entirely, work there — Statamic is the content layer.
  • If nobody is building cohorts or retention analysis, this is a large amount of instrumentation for reporting a dashboard already gives you.

Statamic → Amplitude · what we deliver

What gets built — Statamic → Amplitude

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

    The Amplitude HTTP V2 API, posted server-side with the identity, event type and 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 → Amplitude questions, answered

Send them server-side from a Laravel listener on form submission, using a device ID the browser SDK wrote into a hidden field so the event joins the visitor's browsing.

Free · 30 min

Get Statamic and Amplitude joined properly

Free30 minutesNo obligation