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

TikTok Pixel ttq.track('CompletePayment')

TikTok · Web Pixels API replacement · confidence: medium

Dies 2026-08-26

Paste-ready snippet
analytics.subscribe('checkout_completed', (event) => {
  const { checkout } = event.data;
  if (!checkout || !checkout.totalPrice) return;

  // window.ttq does not exist in the sandbox (no DOM). Forward to TikTok's
  // Events API (server-side) instead — sandbox-correct equivalent of
  // ttq.track('CompletePayment'). Replace PIXEL_CODE and ACCESS_TOKEN
  // (TikTok Events Manager > your pixel > Settings > Events API).
  fetch(`https://business-api.tiktok.com/open_api/v1.3/event/track/`, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json', 'Access-Token': 'ACCESS_TOKEN' },
    keepalive: true,
    body: JSON.stringify({
      pixel_code: 'PIXEL_CODE',
      event: 'CompletePayment',
      event_id: checkout.token,
      timestamp: new Date().toISOString(),
      context: { page: { url: undefined } },
      properties: {
        value: checkout.totalPrice.amount,
        currency: checkout.totalPrice.currencyCode,
        content_ids: checkout.lineItems.map((i) => i.variant && i.variant.id).filter(Boolean),
        content_type: 'product',
      },
    }),
  });
});

Legacy pattern detected via: ttq\.track\(\s*['"]CompletePayment['"]

What this does NOT cover

What this does NOT cover: ttclid (TikTok click ID) attribution — see the paired tiktok-events-api-server-side template for capturing that via browser.cookie.

Test-event verification checklist

  • event_id uses checkout.token so this dedupes against any existing TikTok Events API server call for the same order (TikTok dedups on event + event_id pairs, same pattern as Meta CAPI).
  • value/currency read from checkout.totalPrice, matching what the browser ttq.track call historically reported.
  • Fires once, on the Thank You page, per completed checkout.
  • 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.