Fix guide · Shopify · advanced · about 45 min

TikTok Pixel events have no event ID on Shopify

For the finding “TikTok events have no event ID”. Also for: Any website, WordPress, Webflow, Framer.

What this means

Each event the TikTok Pixel sends can carry an event ID (event_id): a unique label for that one action. Your store’s events arrive with an empty event_id. The TikTok Pixel does not fill in an ID by itself (that is the empty event_id field you see in the Network tab): TikTok asks advertisers to choose a unique ID for each event, and if the code does not pass one, the field stays empty.

Whether this costs you money depends on whether your store also sends these events from a server through the TikTok Events API:

  • Yes, or you are not sure: TikTok deduplicates a browser event and a server event when they share the pixel code, the event name and the event_id. When the server event has no event_id either, TikTok can fall back to the _ttp cookie, but only within 5 minutes, only if first-party cookies are on and the server sends ttp, and only by dropping the server copy. Otherwise both copies can count.
  • No, browser pixel only: there is nothing to deduplicate yet, so this has little effect today. It matters the day you add the Events API.

We cannot see server-to-server traffic from a browser, so we cannot tell whether your Events API works; we only check the browser events.

On Shopify, the Events API is usually switched on in TikTok’s own TikTok app (the sales channel): the Enhanced and Maximum data sharing levels use the Events API next to the pixel, while Standard uses the pixel only. TikTok requires the same event_id on both sides for deduplication, but its Shopify help does not describe how the app sets event IDs. What you can control is every other copy of the pixel: base code in your theme, a custom pixel or a GTM tag sends events without an ID unless someone added one.

How to confirm it yourself

  1. Open your store in a private (incognito) window, open developer tools (F12), go to Network and filter by analytics.tiktok.com/api/v2/pixel.
  2. Accept cookies, then trigger your key events: open a product page and add a product to the cart.
  3. In each request’s payload, event is the event name and event_id is the ID. "event_id": "" means the event has no ID.
  4. Look at the page address a request without an ID reports (under context, page, url). Shopify documents that custom pixels run in a sandbox frame whose address is not your store page, so a Shopify sandbox address (containing /sandbox/) points to a custom pixel. Your normal page address points to code on the page or an app.
  5. Check whether server events exist at all. In TikTok Events Manager (Tools > Events > Data sources > your pixel), the Overview tab shows a Connection Method for each event: “browser only”, “server only” or “server & browser”. TikTok says that if the “Server & Browser” numbers are too low, you should check your deduplication setup; View details under the Event Health column shows deduplication health.

How to fix

TikTok keeps the first copy of an event and discards later copies with the same pixel code, event name and event_id that arrive within 48 hours. So the browser event needs an ID, and the server event needs exactly the same one. On Shopify you have three realistic routes.

Route 1: the TikTok app does both sides (most stores).

  1. In your Shopify admin, open Sales channels > TikTok and check the data sharing level. Choose Enhanced or Maximum to add the Events API, and make sure the pixel you advertise with is the one connected. TikTok notes that Advanced Matching, part of these levels, shares customer data such as email, phone number, name and location, and asks you to make sure your privacy policy reflects this.
  2. Remove every other copy of the same pixel: TikTok code in theme.liquid, custom pixels under Settings > Customer events, TikTok tags in GTM, and app embeds that add a pixel. Those copies keep sending events without IDs, and every event is also sent twice (see “Duplicate TikTok events”).
  3. Repeat the Network test. If the events that remain, now only from the TikTok app, still arrive with an empty event_id while the Enhanced or Maximum level is on, contact TikTok support: TikTok does not document how its Shopify app pairs browser and server events.

If you use a third-party app for the Events API instead, follow its documentation. Such tools set matching IDs for the browser events they send themselves, so that app’s pixel must be the only copy.

Route 2: a custom pixel plus your own server events (developer). In Shopify’s sandbox, TikTok’s code may not see ttclid in the address or keep ttclid and _ttp on your store’s domain; see TikTok click ID lost on Shopify before you choose this route. Every Shopify customer event has an id. Pass it to the TikTok Pixel in the third argument of ttq.track, the place TikTok documents:

analytics.subscribe("product_added_to_cart", (event) => {
  ttq.track('AddToCart', {
    content_type: 'product',
    value: event.data?.cartLine?.cost?.totalAmount?.amount,
    currency: event.data?.cartLine?.cost?.totalAmount?.currencyCode,
  }, { event_id: event.id });
});

Your server must then send exactly the same value as event_id, with the same event name and your pixel code as event_source_id, so it has to receive that ID, for example from the custom pixel. For Purchase, the checkout_completed event includes the order ID (event.data.checkout.order.id), which your server also knows; TikTok suggests order numbers or transaction IDs as event IDs. Whatever you choose, both sides must use the identical string.

Route 3: Google Tag Manager with server-side GTM. In TikTok’s TikTok Pixel tag template, fill De-duplication Configurations > Event ID with a variable that produces a new value per event, and send the same value to your server container. TikTok says its interactive GTM setup in Events Manager configures an event_id variable for you. If GTM runs as a custom pixel, push Shopify’s event.id into the data layer together with each event and use it as the ID. The TikTok Events API setup guide covers the server side.

For all routes, keep first-party cookies on (in Events Manager, your pixel’s Settings tab), so the _ttp fallback still works for any event that slips through without an ID. If TikTok’s code runs in a custom pixel (route 2, or GTM as a custom pixel), check that _ttp is actually stored on your store’s domain: the sandbox may prevent it (see the click ID guide linked above).

Common causes

  • The pixel was pasted into theme.liquid with TikTok’s standard base code and event snippets, which do not include event_id.
  • A custom pixel was built from TikTok’s base code without passing Shopify’s event.id.
  • The Events API was turned on in the TikTok app, but browser events still come from another copy of the pixel.
  • The browser and the server each generate their own ID, so the two never match.

How to verify the fix

  1. In the Network tab, every analytics.tiktok.com/api/v2/pixel request for your key events carries a non-empty event_id, and it changes between actions.
  2. For one test conversion, the server sends the same event_id and event name.
  3. In Events Manager, the “Server & Browser” figures for that event grow (this takes some time; data is not shown in real time).
  4. Re-run the check on IsPixelWorking. The issue should be gone.

Sources

More TikTok guides