Skip to main content
Statamic → MatomoIntegration guide

Connecting Statamic to Matomo

Statamic is a flat-file CMS on Laravel, usually chosen by agencies for content sites where commerce is bolted on rather than central. 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 Statamic or Laravel order record 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

Statamic with self-hosted Matomo: goals from Laravel, one box

On Statamic's form submission event, send a goal conversion through the Matomo PHP tracker with the visitor ID read from Matomo's cookie, so it lands on the right visit. Matomo's JavaScript tag works on cached pages; set per-member values after load. Store collection and entry ID in custom dimensions, and give Matomo its own database resources if sharing a server.

Statamic and Matomo are both PHP, and agencies often host them on the same server. That makes this the most first-party pair on the list, and the server-side half is simple: on Statamic's form submission event, send a goal conversion through the Matomo PHP tracker, carrying the visitor ID read from Matomo's cookie so the conversion lands on the visit that produced it.

Matomo's JavaScript tag keeps working on fully cached pages, so pageviews are fine; what breaks is anything you expected the template to add per request, such as a user ID for logged-in members. Set that from a nocache region or after load. Put the Statamic collection and entry ID in custom dimensions, so content reports survive editors renaming slugs.

Sharing a box is the risk. Statamic's static cache is fast because the web server serves files, and a traffic spike that Statamic handles easily can still overload Matomo's database on the same machine, dropping tracking requests exactly when the campaign is working. Give Matomo its own database resources, archive reports by cron rather than in the browser, and watch tracking request errors during big sends.

Statamic → Matomo · what breaks

Why this join usually fails — Statamic → Matomo

  1. 01

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

    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.

Statamic → Matomo · the fix

What working looks like — Statamic → Matomo

  • The first-party visitor ID on every order

  • 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

Statamic → Matomo · architecture

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

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

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

Statamic → Matomo · normal or broken

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

Normal, not a fault

  • The first-party visitor ID present on the order

  • Sent from your Laravel application's order event

  • 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

    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

    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

Statamic → Matomo · diagnose

Diagnostic order — Statamic → Matomo

  1. 01

    Count orders carrying the first-party visitor 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

    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.

Statamic → Matomo · prove

How it gets proven — Statamic → Matomo

Source of truth

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

  • The first-party visitor ID confirmed present on a live order.
  • Orders reconciled against the Matomo ecommerce log with order-ID deduplication verified.
  • Order data confirmed persisted on a purchase made while full static caching was active.

Statamic → Matomo · free audit

What we check in the free audit

  • Count orders carrying the first-party visitor ID
  • Follow one real conversion end to end
  • Check whether full static caching is enabled
  • Check tracker reachability and database lag before debugging any tag
  • 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 → Matomo · when not to buy

When you don't need this — Statamic → Matomo

  • Measure identifier coverage yourself first — pull your last hundred orders and count how many carry the first-party visitor ID.
  • If commerce lives in a separate system entirely, work there — Statamic is the content layer.
  • 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.

Statamic → Matomo · what we deliver

What gets built — Statamic → Matomo

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

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

  • 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 → Matomo questions, answered

Send a goal conversion from a Laravel listener on the form submission event using the Matomo PHP tracker, with the visitor ID from Matomo's cookie.

Free · 30 min

Get Statamic and Matomo joined properly

Free30 minutesNo obligation