Skip to content

How to Set Up TikTok Events API on Shopify for Server-Side Tracking

Three platforms, three answers, one budget to defend. Your GA4 export already holds the answer, and the first finding is free and never leaves your browser. Get your first finding free

By , Founder & CEOUpdated 8 min read

Run the numbers for your store: the free server-side tracking ROI calculator.

How to Set Up TikTok Events API on Shopify for Server-Side Tracking

Quick Answer: The quickest way to run the TikTok Events API on Shopify is TikTok's own app: set data sharing to Enhanced or Maximum and it sends server events next to the TikTok Pixel. The manual route below is for stores that want their own control: generate an access token in TikTok Events Manager, send Shopify order webhooks to an endpoint you run, and post each purchase to TikTok with the same event_id your Pixel uses, so attribution counts it once.

Browser restrictions and ad blockers stop part of what a pixel sends. The Events API sends the same events from a server instead, and TikTok recommends running it next to your existing Pixel, with deduplication, rather than instead of it.

Understanding the Shift to Server-Side Tracking for TikTok

Pixels and JavaScript snippets are easy to install and easy to stop: browsers' tracking prevention (such as Apple's ITP) and ad blockers block them or cut cookie lifetimes short, and a consent banner rightly holds them back until the visitor agrees. The result is lost events, weaker attribution and ad campaign delivery tuned on a partial count.

Server-side tracking sends event data from your server straight to TikTok's, so browser limits don't apply. Consent still does. Four advantages:

Enhanced Data Accuracy: Purchases, add-to-carts and page views get through even when the browser blocks the pixel, so TikTok's count is more complete.

Improved Data Security: Customer data passes through your server first, so you decide what goes to TikTok and hash it before it leaves.

Reduced Page Load Times: Moving tracking logic off the page can take a little JavaScript off the shopper's device.

Future-Proofing: Browser rules keep tightening; a server connection doesn't depend on them.

For a Shopify store, that means TikTok's delivery system learns from a fuller count of purchases, and the return on ad spend (ROAS) TikTok reports usually goes up with it. Whether your real return goes up is a separate question; the check for that is at the end.

Prerequisites for TikTok Events API Integration on Shopify

Before you start, you'll need:

Shopify Store: An active Shopify store with administrative access.

TikTok for Business Account: A TikTok for Business account with access to TikTok Ads Manager.

TikTok Pixel: Keep the browser Pixel installed. TikTok recommends the Pixel and the Events API together, with deduplication.

Developer Knowledge (Basic): Familiarity with Shopify webhooks and a little server code.

Server-Side Environment (Optional but Recommended): Somewhere to receive webhooks and call TikTok: a cloud function, a small server, an integration platform or a Customer Data Platform (CDP). This guide sticks to Shopify's built-in features and direct API calls.

Step-by-Step Guide: Setting Up TikTok Events API on Shopify

Four stages, from Shopify to TikTok:

Stage 1: Configure Shopify Customer Events

Shopify's customer events run the browser Pixel; its webhooks trigger the server-side calls.

Access Shopify Admin: Log in to your Shopify admin panel.

Navigate to Customer Events: Go to Settings > Customer Events.

Add a Custom Pixel (if not already done): If the TikTok Pixel isn't installed through TikTok's app, add it here as a custom pixel, and have its Purchase event send the order ID as its event_id: that's what lets TikTok match it with the server event later.

Understand Shopify's Webhooks: A webhook makes Shopify send a notification to a URL you choose whenever something happens, such as an order being created. Those notifications trigger the calls to the TikTok Events API.

Stage 2: Generate an Events API Access Token

The Events API belongs to TikTok's API for Business, not to the TikTok for Developers portal, and for a single store you don't need a developer app at all: the access token comes from your pixel.

Open your pixel's settings: In TikTok Ads Manager, open Events Manager (under Assets or Tools, depending on your account), select your web pixel and go to Settings.

Generate the token: Click "Generate Access Token" and copy it straight away; it isn't shown again once you leave the page. Store it as a secret on your server, never in code that runs in the browser.

Note your pixel code: Every call needs the pixel code next to the token, so TikTok knows which pixel the events belong to.

Each call is an HTTPS POST to TikTok's Events API endpoint, with the token in an Access-Token header. A conceptual purchase event (TikTok's API for Business documentation has the full field list):

POST https://business-api.tiktok.com/open_api/v1.3/event/track/
Access-Token: YOUR_ACCESS_TOKEN
Content-Type: application/json

{
  "event_source": "web",
  "event_source_id": "YOUR_PIXEL_CODE",
  "data": [{
    "event": "Purchase",
    "event_time": 1760000000,
    "event_id": "SHOPIFY_ORDER_ID",
    "user": { "email": "SHA256_OF_EMAIL", "phone": "SHA256_OF_PHONE" },
    "properties": { "value": 100.00, "currency": "EUR" }
  }]
}

Stage 3: Configure Shopify Webhooks for Key Events

Next, tell Shopify to send data to your endpoint when an order is created.

Navigate to Webhooks in Shopify: In your Shopify admin, go to Settings > Notifications > Webhooks.

Create Webhooks for Key Events:

  • Order Creation (Purchase Event): This is the one that matters most. * Click "Create webhook." * Event: Select "Order creation." * Format: Select "JSON." * You need an endpoint that can receive the Shopify webhook, process the data, and then send it to the TikTok Events API. * Option A: Custom Server/Cloud Function: The most flexible approach. You would set up a server endpoint (e.g., an AWS Lambda function, Google Cloud Function, or a dedicated server endpoint) that listens for this webhook. This function would parse the Shopify data, format it according to TikTok's Events API specifications, and then make a POST request to the TikTok Events API. * Option B: Integration Platform (e.g., Zapier, Make.com, Pipedream): For those without developer resources, these platforms can act as intermediaries. You would set the webhook URL to a URL provided by your integration platform. The platform would then receive the Shopify data and, using its connectors, send the formatted data to the TikTok Events API. * Option C: Shopify Flow: Flow's Send HTTP request action can post an order to an endpoint, with the access token kept as a Flow secret, but only on the Grow, Advanced and Plus plans, and you still need to hash customer data the way TikTok requires. * Webhook API Version: Select the latest stable version. * Click "Save." * Checkout Creation (Initiate Checkout): Captures when a customer starts the checkout process. * Cart Update (Add to Cart): Captures when items are added to the cart. This might require more advanced setup as Shopify's native webhooks for cart updates are less granular. You might need to rely on client-side events for this or custom development. * Product View (View Content): Typically handled client-side or through more advanced server-side tracking solutions.

Stage 4: Implement the Server-Side Logic (Webhook Receiver to TikTok API)

This is the core technical step. Assuming you chose Option A (Custom Server/Cloud Function) for the webhook URL, here's the logic:

Receive Shopify Webhook: Your custom endpoint receives the JSON payload from Shopify.

Parse Shopify Data: From an order creation payload, take the order ID, the total price and currency, the line items, and the customer's email and phone.

Hash Customer Data: Hash email and phone with SHA-256 before they leave your server, as TikTok requires.

Send the Event: Post a Purchase event to the Events API (see Stage 2), with the order ID as event_id and the order's time as event_time. Your Pixel's Purchase event has to carry the same event_id: TikTok only deduplicates a Pixel and an Events API event that share the event name and event_id, and only within 48 hours of the first one.

Verify: In TikTok Events Manager, send test events and watch them arrive in the Test Events tab, filtered to server events, then check the Diagnostics tab for problems.

Once real purchases flow, put TikTok's Purchase events next to your Shopify orders each week; with deduplication working, they should land close. More events make TikTok's count more complete, not more neutral, and TikTok will happily credit an ad someone watched for six seconds. Before you move budget on the new numbers, pause TikTok in one region for two weeks and compare revenue with the rest, the simplest form of incrementality testing.

Organic Social Attribution: How to Measure What Seems Unmeasurable

TikTok Pixel Attribution Issues: What the Data Really Shows

Cookie limits and your attribution

What iOS privacy changes did to tracking

Frequently asked questions

  • How much does accurate marketing attribution cost for Shopify stores?
    Checking your own numbers costs nothing but time: TikTok Events Manager, GA4's attribution reports and a Shopify orders export are free, and a two-week regional holdout costs only the sales the paused ads were really driving. Attribution tools range from free plans to quotes through sales, so price one against the budget decision it will inform.

Go deeper: Causal attribution, explained.

Sixty-second versions of these ideas: Causality Engine on YouTube Shorts.

Have an audience of ecommerce operators? Earn 20% recurring commission by recommending the €99 read.

Keep reading

Terms in this article

Browse the full glossary

Your platforms guess.
We run the math.

Upload a GA4 export and see what each channel caused, next to last-click, in 1–2 minutes. The read is yours to keep.

The free finding runs in your browser. Your file never leaves it. The full read is €99, refundable within 30 days, no questions asked. Prices exclude VAT.