Connecting Craft CMS to Amplitude
Craft is a developer-oriented CMS, usually built bespoke by an agency, which means the implementation is whatever that agency decided and nothing is standard. 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 Craft Commerce order 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
Craft Commerce orders in Amplitude without splitting the customer
Store the Amplitude device_id on the Craft Commerce cart as a custom field, so the order-complete listener's server event carries it plus a deliberately chosen user_id. Send revenue per line item with price, quantity and variant SKU, insert_id from order reference plus line item ID, and refunds as negative revenue, without a duplicate browser purchase.
Amplitude needs the order to land on the same person who browsed, and a Craft Commerce checkout gives you two chances to lose that. Guest checkout means many buyers never sign in with a Craft account, and how Commerce stores guest customers has changed between versions, so check what your build actually records before choosing a user_id. An ID derived from the customer email merges repeat guest buyers; the Craft user ID only works if most customers log in.
Store the browser SDK's device_id on the cart as a custom field when the cart is created. Because a Craft cart is an incomplete Order element, that value is still on the order when the order-complete listener fires in PHP, and the server event can carry the same device_id plus the user_id. Send revenue per line item with price and quantity taken from the line item and productId set to the variant SKU, so Amplitude's revenue charts populate, and build insert_id from the order reference plus the line item ID.
Refunds recorded against the order should go in as negative-revenue events, not deletions. The usual break is a Twig confirmation template firing the browser SDK's purchase from a cached block while the server also sends one, so the same order lands twice under different insert_ids.
Craft → Amplitude · what breaks
Why this join usually fails — Craft → Amplitude
- 01
The user ID and device ID pair never reaches Craft
Craft's template caching and static caching plugins both serve stored output, and because every build is custom, where the capture code lives differs per site. There is no standard place to look.
- 02
Every install is bespoke
There is no standard Craft setup, so an approach that worked on another Craft site may have nothing to attach to on this one. Read the build before quoting.
- 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.
- 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.
Craft → Amplitude · the fix
What working looks like — Craft → 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
Craft CMS's own records are the reference, not either dashboard.
Craft → Amplitude · architecture
How Craft and Amplitude actually connect
- 1
Craft CMS holds the truth
Craft installs are bespoke by nature. Establish how this particular build models a completed order before assuming anything transfers from another Craft site.
- 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
The identifier is the bridge
The user ID and device ID pair, captured at the visit and carried into the Craft Commerce order.
- 4
The event source decides reliability
Fire from the event listener in PHP rather than a Twig template, which may be cached.
- 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.
Craft → Amplitude · normal or broken
Working vs. broken, side by side — Craft → Amplitude
Normal, not a fault
The user ID and device ID pair present on the order
Visible on the record itself in Craft CMS, not merely captured somewhere on the site.
Sent from the Craft Commerce order-complete 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
Amplitude's count and Craft CMS's records agree within a few percent over a closed window.
Actually broken
The user ID and device ID pair missing on most records
Craft's template caching and static caching plugins both serve stored output, and because every build is custom, where the capture code lives differs per site. There is no standard place to look.
Sent from the browser
There is no standard Craft setup, so an approach that worked on another Craft site may have nothing to attach to on this one. Read the build before quoting.
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
The dashboard shows a number and no one has compared it to Craft CMS.
Craft → Amplitude · diagnose
Diagnostic order — Craft → Amplitude
- 01
Count orders carrying the user ID and device ID pair
- 02
Follow one real conversion end to end
- 03
Read how this specific build handles order completion
Assumptions carried from another Craft project are the main source of wasted time here.
- 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.
- 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.
Craft → Amplitude · prove
How it gets proven — Craft → Amplitude
Against Craft CMS's own records, not against either platform's dashboard.
Source of truth
Craft Commerce's order records in your own database, filtered to completed.
- 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 custom field confirmed populated on an order placed as an anonymous visitor through cache.
Craft → 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
- Read how this specific build handles order completion
- Check a purchase event for the price and quantity fields specifically
- Read the match rate, not the success message
Checked against
Craft Commerce's order records in your own database, filtered to completed.
Free30 minutesNo obligation
Craft → Amplitude · when not to buy
When you don't need this — Craft → Amplitude
- If Amplitude already reports conversions that reconcile against Craft CMS's records within a few percent, this join is working and there is nothing to buy.
- Measure identifier coverage yourself first — pull your last hundred orders and count how many carry the user ID and device ID pair.
- If the original agency is still engaged, the fastest path is usually specifying the field and having them add the hook.
- If nobody is building cohorts or retention analysis, this is a large amount of instrumentation for reporting a dashboard already gives you.
Craft → Amplitude · what we deliver
What gets built — Craft → Amplitude
Identifier capture into Craft
Capture the identifier and store it as a custom field on the order through a Craft event listener, server-side.
Event source: the Craft Commerce order-complete event
Fire from the event listener in PHP rather than a Twig template, which may be cached.
Dispatch to Amplitude
The Amplitude HTTP V2 API, posted server-side with the identity, event type and properties.
Reversals where they exist
Refunds and cancelled orders are recorded against the order.
Written guarantee
95%+ tracking accuracy
Measured against Craft Commerce's order records in your own database, filtered to completed.. Miss it and we keep working at no cost.
From $400 · See packages
FAQ
Craft → Amplitude questions, answered
From PHP, on the order-complete event. Twig output can be cached, and the server event can carry the stored device_id so it still joins the browsing history.
The events are missing price and quantity in the fields Amplitude expects. Map them from each Commerce line item rather than sending only the order total as a custom property.
Almost always because the user ID and device ID pair never reached the Craft Commerce order. Craft's template caching and static caching plugins both serve stored output, and because every build is custom, where the capture code lives differs per site. There is no standard place to look. Measure coverage before debugging the dispatch.
Amplitude tracks both a device ID and a user ID and merges them when a user identifies. The merge rules decide who counts as one person, so a mistake here does not produce a small error — it changes every retention curve and cohort size in the account.
The Craft Commerce order-complete event. Fire from the event listener in PHP rather than a Twig template, which may be cached.
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.
More on Craft → Amplitude
- Craft → Google AdsConnecting Craft CMS to Google Ads
- Craft → MetaConnecting Craft CMS to Meta Conversions API
- Craft → GA4Connecting Craft CMS to GA4
RELATED GUIDES
Where Craft → Amplitude fits in the rest of your tracking
- Concrete CMS → AmplitudeConnecting Concrete CMS to Amplitude
- Umbraco → AmplitudeConnecting Umbraco to Amplitude
- Drupal Commerce → AmplitudeConnecting Drupal Commerce to Amplitude
- Craft → PostHogConnecting Craft CMS to PostHog
- Craft → GA4Connecting Craft CMS to GA4
- Local servicesConversion tracking for local businesses, where most conversions bypass the website
- Statamic → AmplitudeConnecting Statamic to Amplitude
- Sitecore → AmplitudeConnecting Sitecore to Amplitude
Free · 30 min
Get Craft and Amplitude joined properly
Free30 minutesNo obligation
