Connecting Craft CMS to TikTok Events API
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. TikTok's audience skews to exactly the browsers and app contexts where browser-side tracking performs worst. The join between them succeeds or fails on one thing: whether the ttclid reaches the Craft Commerce order before the conversion happens, because TikTok can only match a conversion it can tie back to a click it recognizes.
Free30 minutesNo obligation
Specific to this pair
Craft Commerce purchases to the TikTok Events API
Make Craft's static cache ignore ttclid while it still reaches the browser, then store it in a first-party cookie and an order custom field. Send CompletePayment to the TikTok Events API from the order-completion listener with value, currency, the order reference as event_id and hashed email and phone, matching the Twig pixel's event_id.
TikTok traffic arrives at a Craft site inside TikTok's in-app browser, often on a landing page with a ttclid parameter that Blitz or another static cache may strip or ignore when it decides which cached page to serve. Check that the cache key ignores ttclid but that the parameter still reaches the visitor's browser, then write it to a first-party cookie and onto the Commerce order through a custom field.
From there, a PHP listener on order completion sends CompletePayment to the Events API with value, currency, the order reference as event_id and hashed email and phone from the order. The TikTok pixel in the Twig confirmation template must use that same event_id. A cached confirmation template is the most likely reason the two IDs disagree on a Craft site.
Shoppers who come from TikTok frequently start in the in-app browser and finish on their phone's main browser, where the ttclid cookie does not exist. The order email and phone are what rescue those orders, so make sure the listener sends them hashed even when no ttclid is on the order.
Craft → TikTok · what breaks
Why this join usually fails — Craft → TikTok
- 01
The ttclid 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
The ttclid is lost in the in-app browser
TikTok traffic arrives through an in-app webview whose storage behavior is inconsistent. An identifier captured but not immediately persisted server-side often is not there by the time the conversion happens.
- 04
Nothing reconciles afterwards
TikTok Events Manager shows received events and their match status. As with Meta, arriving is not the test — deduplicated and matched is. Reconcile TikTok's reported conversions against the source system for the same window.
Craft → TikTok · the fix
What working looks like — Craft → TikTok
The ttclid on every order
Conversions arriving in TikTok
Events appear in TikTok Events Manager, deduplicated against the pixel, and become usable for optimization.
Reconciled against the source
Craft CMS's own records are the reference, not either dashboard.
Craft → TikTok · architecture
How Craft and TikTok 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
TikTok Events API needs a click to match
TikTok matches server events using ttclid where available, falling back to hashed contact information. Both should be sent — the fallback is what carries the events where the click ID did not survive.
- 3
The identifier is the bridge
The ttclid, 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
TikTok deduplicates on event_id, the same pattern as Meta: the pixel and the Events API must send the same event_id for the same conversion. Mismatched IDs mean double counting.
Craft → TikTok · normal or broken
Working vs. broken, side by side — Craft → TikTok
Normal, not a fault
The ttclid 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
TikTok deduplicates on event_id, the same pattern as Meta: the pixel and the Events API must send the same event_id for the same conversion. Mismatched IDs mean double counting.
Reconciles with the source
TikTok's count and Craft CMS's records agree within a few percent over a closed window.
Actually broken
The ttclid 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
TikTok traffic arrives through an in-app webview whose storage behavior is inconsistent. An identifier captured but not immediately persisted server-side often is not there by the time the conversion happens.
Nobody has reconciled it
The dashboard shows a number and no one has compared it to Craft CMS.
Craft → TikTok · diagnose
Diagnostic order — Craft → TikTok
- 01
Count orders carrying the ttclid
- 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
Measure ttclid capture rate on TikTok traffic specifically
Not on all traffic. TikTok's in-app browser is the failure case, so a healthy overall capture rate can hide a poor one on exactly the traffic that matters.
- 05
Read the match rate, not the success message
TikTok Events Manager shows received events and their match status. As with Meta, arriving is not the test — deduplicated and matched is. Reconcile TikTok's reported conversions against the source system for the same window.
Craft → TikTok · prove
How it gets proven — Craft → TikTok
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 ttclid confirmed present on a live order.
- Deduplication confirmed in Events Manager, and ttclid capture rate measured on TikTok traffic specifically.
- Order custom field confirmed populated on an order placed as an anonymous visitor through cache.
Craft → TikTok · free audit
What we check in the free audit
- Count orders carrying the ttclid
- Follow one real conversion end to end
- Read how this specific build handles order completion
- Measure ttclid capture rate on TikTok traffic 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 → TikTok · when not to buy
When you don't need this — Craft → TikTok
- If TikTok 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 ttclid.
- If the original agency is still engaged, the fastest path is usually specifying the field and having them add the hook.
- If TikTok is a small share of spend, the effort is hard to justify. It pays when TikTok is a channel you are actively scaling.
Craft → TikTok · what we deliver
What gets built — Craft → TikTok
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 TikTok
Server events to the TikTok Events API with the ttclid, hashed contact information and a matching event_id.
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 → TikTok questions, answered
Often because the ttclid never reached the order: lost to the cache, to the in-app browser, or never saved to a field. Sending hashed email and phone from the server recovers part of it.
Not necessarily. A small module listening for order completion and calling the Events API is often simpler on a bespoke Craft build. Check the Plugin Store first.
Almost always because the ttclid 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.
The ttclid — TikTok's click identifier, appended to your landing page URL and also stored in the _ttp cookie. TikTok additionally matches on hashed email and phone. In-app browser behavior makes ttclid capture more fragile than the equivalents on other platforms, so persisting it server-side as soon as it is seen matters more here than elsewhere.
The Craft Commerce order-complete event. Fire from the event listener in PHP rather than a Twig template, which may be cached.
TikTok Events Manager shows received events and their match status. As with Meta, arriving is not the test — deduplicated and matched is. Reconcile TikTok's reported conversions against the source system for the same window.
More on Craft → TikTok
- 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 → TikTok fits in the rest of your tracking
- TikTok · Local servicesTikTok Ads conversion tracking for local service businesses
- TikTok · B2BTikTok Ads conversion tracking for B2B companies
- TikTok × CRM DealsHow to reconcile TikTok Ads against your CRM's closed-won deals
- TikTok · Comparison page → demoHow to track comparison page visit to demo request for TikTok Ads
- Ghost → TikTokConnecting Ghost memberships to TikTok Events API
- Craft → QuoraConnecting Craft CMS to Quora Ads
- Local servicesConversion tracking for local businesses, where most conversions bypass the website
- Umbraco → TikTokConnecting Umbraco to TikTok Events API
Free · 30 min
Get Craft and TikTok joined properly
Free30 minutesNo obligation
