We’re upgrading our email infrastructure — for immediate response, email andrewjgaber@gmail.com meanwhile.
Skip to main content
Part of Digital Empire
TikTok

TikTok Events API server-side integration (ttclid capture dependency)

TikTok · Web Pixels API replacement · confidence: medium

Dies 2026-08-26

Paste-ready snippet
// This pattern covers stores where server-side TikTok Events API is already
// correctly wired, but ttclid (TikTok click ID, needed for click-attribution
// matching) was captured into a cookie by a script injected in
// checkout.liquid or Additional Scripts. That capture point dies Aug 26; the
// Events API server call itself is unaffected once ttclid keeps flowing.
analytics.subscribe('checkout_started', (event) => {
  // Read ttclid from the URL the customer arrived with, persisted earlier by
  // your ad-click landing page into a first-party cookie BEFORE checkout —
  // this subscription re-persists it at checkout start via the sandboxed
  // browser.cookie API so it survives through to your order-webhook-based
  // server-side Events API call.
  browser.cookie.get('ttclid').then((existing) => {
    if (existing) {
      browser.cookie.set('ttclid', existing);
    }
  });
});

Legacy pattern detected via: ttclid[\s\S]{0,80}checkout\.liquid|document\.cookie[\s\S]{0,40}ttclid

What this does NOT cover

What this does NOT cover: first-touch ttclid capture on the landing page itself — that is a separate, non-checkout script and outside this library's Aug-26 scope.

Test-event verification checklist

  • browser.cookie.get() is awaited/then-chained — it returns a Promise, not a synchronous value, per the Web Pixels browser API.
  • This snippet only re-affirms an EXISTING ttclid cookie captured earlier in the funnel (e.g. on ad-landing-page arrival) — it does not itself parse ttclid from the current URL, since checkout pages do not carry the original ad click-through URL params.
  • Verify the order-webhook server-side Events API call reads this same cookie (via Shopify order note_attributes or a checkout attribute) — that wiring is server-side, outside this pixel.
  • Verify live against the platform's own test-event tool: https://ads.tiktok.com/help/article/events-manager-test-events

Related paste-ready snippets

TikTok Pixel + Events API · Both the client ttq pixel and the server-side TikTok Events API integration.