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 noevent_ideither, TikTok can fall back to the_ttpcookie, but only within 5 minutes, only if first-party cookies are on and the server sendsttp, 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
- Open your store in a private (incognito) window, open developer tools (F12), go to Network and filter by
analytics.tiktok.com/api/v2/pixel. - Accept cookies, then trigger your key events: open a product page and add a product to the cart.
- In each request’s payload,
eventis the event name andevent_idis the ID."event_id": ""means the event has no ID. - 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. - 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).
- 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.
- 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”). - Repeat the Network test. If the events that remain, now only from the TikTok app, still arrive with an empty
event_idwhile 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.liquidwith TikTok’s standard base code and event snippets, which do not includeevent_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
- In the Network tab, every
analytics.tiktok.com/api/v2/pixelrequest for your key events carries a non-emptyevent_id, and it changes between actions. - For one test conversion, the server sends the same
event_idand event name. - In Events Manager, the “Server & Browser” figures for that event grow (this takes some time; data is not shown in real time).
- Re-run the check on IsPixelWorking. The issue should be gone.
Sources
- TikTok Business Help Center, Data Sharing on TikTok App on Shopify (Standard, Enhanced, Maximum; Events API and Advanced Matching): https://ads.tiktok.com/resources/help/article/data-sharing-tiktok-app-shopify?lang=en
- TikTok For Business Blog, Expanded Shopify integration strengthens ad performance for merchants (Enhanced and Maximum include the Events API): https://ads.tiktok.com/business/en-US/blog/shopify-ecommerce-integration-pixel-events-api
- TikTok Business Help Center, TikTok Pixel for Shopify (Advanced Matching shares email, phone number, name and location; privacy policy): https://ads.tiktok.com/resources/help/article/tiktok-pixel-shopify?lang=en
- TikTok Business Help Center, Event deduplication (share
event_idthrough both Pixel and Events API): https://ads.tiktok.com/resources/help/article/event-deduplication?lang=en - TikTok API for Business, Event Deduplication (keys
event_source_id,eventandevent_id; 48 hours;_ttpfallback; unique IDs such as order numbers; Server & Browser metrics, Event Health): https://business-api.tiktok.com/portal/docs?id=1771100965992450 - TikTok API for Business, Events API 2.0 setup guide for Web (
event_idrequired when sending from both; first-party cookies setting): https://business-api.tiktok.com/portal/docs?id=1771100865818625 - TikTok Business Help Center, Events Manager: monitor and diagnose (Connection Method, data not in real time): https://ads.tiktok.com/resources/help/article/tiktok-events-manager-monitor-and-diagnose?lang=en
- TikTok API for Business, Events API and Pixel setup with Google Tag Manager (interactive setup configures an
event_idvariable): https://business-api.tiktok.com/portal/docs?id=1799004052020225 - TikTok on GitHub, TikTok Pixel GTM template (De-duplication Configurations > Event ID): https://github.com/tiktok/gtm-template-pixel
- Shopify Help Center, Manage your custom pixels (remove existing pixels so events aren’t counted twice): https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/manage
- Shopify.dev, About web pixels (custom pixels run in a sandbox iframe): https://shopify.dev/docs/apps/build/marketing/pixels
- Shopify.dev,
page_viewedevent (every customer event has anid): https://shopify.dev/docs/api/web-pixels-api/standard-events/page_viewed - Shopify.dev,
product_added_to_cartevent (cartLine.cost.totalAmount): https://shopify.dev/docs/api/web-pixels-api/standard-events/product_added_to_cart - Shopify.dev,
checkout_completedevent (order ID): https://shopify.dev/docs/api/web-pixels-api/standard-events/checkout_completed
More TikTok guides
- TikTok Pixel fires before cookie consent on Shopify
- TikTok Pixel not firing after cookie consent on Shopify
- Repeated TikTok event IDs drop real conversions: how to fix
- Duplicate TikTok Pixel events on Shopify
- TikTok click ID (ttclid) lost on Shopify
- TikTok Pixel tracks a button on desktop but not on mobile
- Two TikTok Pixels on one site: when it's fine, how to fix
- TikTok Events API deduplication: match the pixel's event_id
- How to set up the TikTok Events API (with deduplication)