Fix guide · Any website · medium · about 30 min
TikTok click ID (ttclid) lost after an ad click: how to fix it
For the finding “Click ID from TikTok ads is not stored”. Also for: Shopify, WordPress, Webflow, Framer.
What this means
When someone clicks a TikTok ad, TikTok adds a click ID to the landing page address: ?ttclid=.... The TikTok Pixel on your site reads it, stores it in a first-party cookie that is also named ttclid, and sends it with its events, so that a lead or purchase later in the visit (or on a later visit) can be tied back to the ad click.
On your site, the click ID did not make it: it was not stored, or not sent with the pixel’s events.
Why it costs you money:
- TikTok has a weaker link between ad clicks and conversions, which lowers attribution and reported results.
- Campaigns optimize on less complete data, so you may pay more per result.
- If you send server events through the TikTok Events API, they usually take the click ID from the same cookie. If it is missing in the browser, it is missing on the server too.
How to confirm it yourself
Our check opens your page in a browser in the EU as if arriving from a TikTok ad, with a test click ID in the URL, accepts the cookie banner, and then looks for the click ID. If our report shows a redirect chain, look at it first: it often shows exactly where the parameter was dropped.
To repeat this yourself:
- Open a private (incognito) window and open developer tools (F12) on the Network tab. Tick Preserve log so redirects stay visible.
- Open your page with a made-up click ID added, for example
https://example.com/?ttclid=test123. (This sends a normal page view to your own pixel. It does not create an ad click.) - Look at the first requests in the Network list. If you see a
301,302,307or308redirect, click it and check the Location header: does the new address still containttclid=test123? If not, the redirect drops the click ID before any script on your site runs. - Accept the cookie banner and wait a few seconds.
- Open the Application tab (Chrome) or Storage tab (Firefox), then Cookies for your domain, and find
ttclid. It should holdtest123. You should also see_ttp, the pixel’s browser ID. - Filter the Network tab by
analytics.tiktok.com/api/v2/pixeland open an event request: the click ID is passed in the event’s context (look for your test value in the payload).
If the ttclid cookie is missing, or holds something else, the click ID is being lost.
How to fix
Work through the chain: the link must arrive with ttclid, the pixel must run on that page, and it must be allowed to write first-party cookies.
- Fix redirects that drop the query string. This is the most common cause, and it happens before any tracking code can run.
- Make your ads link straight to the final address: the exact protocol (
https), host (with or withoutwww) and path (with or without the trailing slash) your site ends up on. - Check redirect rules at your host, CDN or server (
httptohttps, non-wwwtowwwor back, old paths to new ones, language or country redirects). Each rule should keep the query string; many tools call this “preserve query string” or “forward parameters”. - Avoid link shorteners and tracking redirectors in ad URLs unless you have tested that they pass
ttclidthrough. TikTok notes the click ID can be up to 1,000 characters long; do not truncate it.
- Make your ads link straight to the final address: the exact protocol (
- Make sure the pixel runs on the landing page after consent. The pixel reads
ttclidfrom the address of the page it runs on. If it waits for consent and does not start after the visitor accepts, or only starts on the next page (where the URL no longer hasttclid), the cookie is never written. See “TikTok Pixel does not fire after consent”. - Check that first-party cookies are on. In TikTok Events Manager, open Tools > Events > Data sources, select your pixel and open the Settings tab. First-party cookies are on by default, but they can be switched off there; TikTok says that when they are off, no new first-party cookies are set. TikTok’s Pixel Helper reports this as “First-Party Cookies Not Found”.
- Check that nothing rewrites the URL first. Some sites, single-page apps and “clean URL” scripts strip unknown parameters from the address bar on load. If the pixel loads after that, it never sees
ttclid. TikTok recommends placing the base code as early as possible in the<head>. - Check that your consent tool is not deleting the cookie. Some consent tools delete marketing cookies they consider unapproved. After Accept,
ttclidand_ttpshould stay. - Pass the click ID to your server events. For the Events API, send it as
user.ttclidand the_ttpvalue asuser.ttp. TikTok also reads attclidparameter frompage.urlif it is there. If you store the click ID yourself, TikTok recommends keeping it for 28 days or more and refreshing it when a newttclidarrives.
Common causes
- A redirect without the query string:
httptohttps, addingwww, adding a trailing slash, or a language redirect. - A link shortener or tracking redirect in the ad URL.
- The pixel waits for consent and does not fire after Accept, or only fires on the next page.
- First-party cookies are switched off in the pixel’s settings.
- A script strips query parameters before the pixel reads them.
- Server events are sent without
ttclidandttp.
How to verify the fix
- Repeat the test above: no redirect drops
?ttclid=test123, and after accepting cookies thettclidcookie holdstest123. - Open another page on your site:
ttclidis still there. - Re-run the check on IsPixelWorking. The issue should be gone, and the redirect chain in the report (if any) should keep the click ID.
Sources
- TikTok Business Help Center, TikTok Click ID (
ttclidappended to landing page URLs, click window): https://ads.tiktok.com/resources/help/article/tiktok-click-id?lang=en - TikTok API for Business, Send TikTok Click ID (ttclid) (pixel stores it in a first-party cookie named
ttclid, up to 1,000 characters, keep for 28 days or more,user.ttclid, parsed frompage.url): https://business-api.tiktok.com/portal/docs?id=1771100879787009 - TikTok Business Help Center, Using cookies with TikTok Pixel (
ttclidand_ttpfirst-party cookies, first-party cookies on by default, no new cookies when off): https://ads.tiktok.com/resources/help/article/using-cookies-with-tiktok-pixel?lang=en - TikTok API for Business, Events API 2.0 setup guide for Web (first-party cookies in pixel Settings): https://business-api.tiktok.com/portal/docs?id=1771100865818625
- TikTok API for Business, Send TikTok Cookie (_ttp) (
user.ttpfrom the_ttpcookie): https://business-api.tiktok.com/portal/docs?id=1771100936446977 - TikTok Business Help Center, TikTok Pixel Helper (“First-Party Cookies Not Found”, place the pixel code early in the head): https://ads.tiktok.com/resources/help/article/tiktok-pixel-helper-2.0?lang=en
More TikTok guides
- TikTok Pixel fires before cookie consent: how to fix it
- TikTok Pixel not firing after cookie consent: how to fix it
- Repeated TikTok event IDs drop real conversions: how to fix
- Duplicate TikTok Pixel events: how to find and remove them
- TikTok Pixel event_id missing: how to add it for deduplication
- 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)