Skip to main content
Drupal Commerce → TikTokIntegration guide

Connecting Drupal Commerce to TikTok Events API

Drupal Commerce is self-hosted commerce inside a CMS built for complex content, which means the store is one part of a much larger site you fully control. 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 Drupal 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

Drupal Commerce to TikTok: CompletePayment from order placement

Send TikTok CompletePayment through the Events API from an event subscriber on the Drupal Commerce place transition, with value, currency and contents using the variation SKU as content_id. Capture ttclid client-side into a first-party cookie and copy it onto the order with the checkout request's IP and user agent, and share the order ID as event_id with the pixel.

Check whether a maintained Drupal module covers the TikTok pixel for your version. Most Drupal Commerce stores add it through a GTM container instead and send Events API calls from custom code, which is the better arrangement anyway. Send CompletePayment from an event subscriber on the order's place transition with value, currency and a contents array built from the order items, using the product variation SKU as content_id so it lines up with your TikTok catalog if you run catalog ads.

TikTok's ttclid has the same CDN problem as any click parameter on a Drupal site: if Varnish or the CDN strips unknown query parameters, the server never sees it. Capture it client-side into a first-party cookie on landing and copy it onto the order at checkout. Store the customer's IP and user agent from the checkout request too, because a place transition triggered by an off-site gateway's notify request has neither.

The TikTok-specific failure is the in-app browser meeting an off-site gateway. A shopper paying through a redirect or a pop-up in TikTok's in-app browser can fail to return, leaving the order in draft so the place transition never fires. Compare abandoned drafts from TikTok-sourced sessions with completed orders; a high share points to the payment step, not the tracking. Share the order ID as event_id between pixel and server.

Drupal Commerce → TikTok · what breaks

Why this join usually fails — Drupal Commerce → TikTok

  1. 01

    The ttclid never reaches Drupal Commerce

    Drupal's internal page cache and any reverse proxy in front of it serve stored renders, so anything relying on dynamically rendered values fails intermittently. Multilingual and multi-site installs add further paths where the capture code may simply not run.

  2. 02

    Configurable workflow states nobody agreed on

    Drupal Commerce lets each install define its own order states. Two people reporting on the same store routinely count different states and never reconcile.

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

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

Drupal Commerce → TikTok · the fix

What working looks like — Drupal Commerce → 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

Drupal Commerce → TikTok · architecture

How Drupal Commerce and TikTok actually connect

  1. 1

    Drupal Commerce holds the truth

    You own the database, so the truth is exactly as good as the query. Pin down which order states count as revenue before comparing anything — Drupal's workflow states are configurable per install, so no two sites agree by default.

  2. 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. 3

    The identifier is the bridge

    The ttclid, captured at the visit and carried into the Drupal Commerce order.

  4. 4

    The event source decides reliability

    Fire server-side from the hook rather than the checkout completion template, which is cacheable and may not execute anything.

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

Drupal Commerce → TikTok · normal or broken

Working vs. broken, side by side — Drupal Commerce → TikTok

Normal, not a fault

  • The ttclid present on the order

  • Sent from the Drupal Commerce order placement hook

  • 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

Actually broken

  • The ttclid missing on most records

    Drupal's internal page cache and any reverse proxy in front of it serve stored renders, so anything relying on dynamically rendered values fails intermittently. Multilingual and multi-site installs add further paths where the capture code may simply not run.

  • Sent from the browser

    Drupal Commerce lets each install define its own order states. Two people reporting on the same store routinely count different states and never reconcile.

  • 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

Drupal Commerce → TikTok · diagnose

Diagnostic order — Drupal Commerce → TikTok

  1. 01

    Count orders carrying the ttclid

  2. 02

    Follow one real conversion end to end

  3. 03

    List the order states in use and agree which count as revenue

    Do this before any technical work — it resolves more Drupal Commerce disputes than any code change.

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

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

Drupal Commerce → TikTok · prove

How it gets proven — Drupal Commerce → TikTok

Source of truth

Drupal's commerce_order records in your own database, filtered to completed states.

  • The ttclid confirmed present on a live order.
  • Deduplication confirmed in Events Manager, and ttclid capture rate measured on TikTok traffic specifically.
  • Order field data confirmed populated on an order placed through a fully warmed cache as an anonymous visitor.

Drupal Commerce → TikTok · free audit

What we check in the free audit

  • Count orders carrying the ttclid
  • Follow one real conversion end to end
  • List the order states in use and agree which count as revenue
  • Measure ttclid capture rate on TikTok traffic specifically
  • Read the match rate, not the success message

Checked against

Drupal's commerce_order records in your own database, filtered to completed states.

Get my free conversion tracking audit

Free30 minutesNo obligation

Drupal Commerce → TikTok · when not to buy

When you don't need this — Drupal Commerce → TikTok

  • Measure identifier coverage yourself first — pull your last hundred orders and count how many carry the ttclid.
  • If your Drupal site is content-only with commerce elsewhere, work at the commerce system instead — this is the wrong layer.
  • 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.

Drupal Commerce → TikTok · what we deliver

What gets built — Drupal Commerce → TikTok

  • Identifier capture into Drupal Commerce

    Capture the identifier and persist it as order field data through a hook on order placement, server-side, so it never depends on what the cache served.

  • Event source: the Drupal Commerce order placement hook

    Fire server-side from the hook rather than the checkout completion template, which is cacheable and may not execute anything.

  • 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

    Order state transitions to refunded or cancelled are recorded and can drive reversals.

Written guarantee

95%+ tracking accuracy

Measured against Drupal's commerce_order records in your own database, filtered to completed states.. Miss it and we keep working at no cost.

Get my free conversion tracking audit

From $400 · See packages

FAQ

Drupal Commerce → TikTok questions, answered

Check drupal.org for a maintained module that supports your version. Many stores load the pixel through Google Tag Manager and send Events API calls from custom code on order placement.

Free · 30 min

Get Drupal Commerce and TikTok joined properly

Free30 minutesNo obligation