Fix guide · WordPress · medium · about 45 min
TikTok click ID (ttclid) lost on WordPress
For the finding “Click ID from TikTok ads is not stored”. Also for: Any website, Shopify, Webflow, Framer.
What this means
When someone clicks a TikTok ad, TikTok adds ?ttclid=... to the landing page address. The TikTok Pixel on your site should store it in a first-party cookie that is also named ttclid and send it with its events, so a lead or purchase later in the visit can be tied back to the ad click. On your site, the click ID did not make it.
Why it costs you money:
- TikTok has a weaker link between ad clicks and conversions, which lowers attribution and reported results.
- If you send server events through the TikTok Events API (TikTok’s plugin and several tracking plugins can), they usually take the click ID from the same visit, so they lose it 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 looks for the click ID. If our report shows a redirect chain, start there.
- Log out of WordPress or use a private (incognito) window. Some plugins that remove URL parameters skip logged-in users, so you would not see the problem while logged in.
- Open developer tools (F12) on the Network tab and tick Preserve log, so redirects stay visible.
- Open the exact URL your ads use, with a made-up click ID added:
https://yourdomain.com/landing-page/?ttclid=test123. (This sends a normal page view to your own pixel. It does not create an ad click.) - If the first request is a redirect (
301,302,307,308), check its Location header. Does the new address still containttclid=test123? - Accept the cookie banner, wait a few seconds, then go to Application > Cookies (Chrome) or Storage > Cookies (Firefox) and look for
ttclid. It should holdtest123. You should also see_ttp.
If TikTok’s plugin is active, you may also see tiktok_ttclid. That is the plugin’s own copy, set from your server, which it sends with its Events API events. It does not replace the pixel’s ttclid cookie.
How to fix
-
Link your ads to the final address. WordPress redirects other versions of an address to its canonical one: the
httporhttpsandwwwor non-wwwversion set in Settings > General (WordPress Address and Site Address), and the trailing slash that your permalink structure in Settings > Permalinks uses. Use the exact final address in every ad, so visitors land without a redirect, and test it as above. -
Check the Redirection plugin, if you use it (Tools > Redirection). Each redirect has a query parameter setting:
- Exact (the default) only matches the query you entered, so an ad URL with
ttclidmay not be redirected at all; - Ignore matches but drops the parameters;
- Pass matches and passes the parameters on to the target.
For any redirect your ads go through, choose Pass. You can change the default for new redirects under Tools > Redirection > Options (Default query matching).
- Exact (the default) only matches the query you entered, so an ad URL with
-
Check URL cleanup in your SEO plugin. Yoast SEO’s URL cleanup option (in its Crawl optimization settings) redirects away unregistered URL parameters. The only ones it never removes are
gclidandutm_parameters, sottclidis removed. It also removes nothing for logged-in users, which is why you may not have noticed. If it is on, addttclidto the parameters you want to keep, or turn the cleanup off. Check any other SEO, security or caching plugin with a “remove query strings” or “clean URLs” option the same way. -
Check language redirects. WPML’s Browser language redirect (WPML > Settings > URLs and SEO) sends visitors to the version in their browser’s language, and Polylang’s Detect browser language option redirects first-time visitors of the home page. Test your ad URL with a browser set to another language. If the redirect drops
ttclid, link your ads directly to the language version the audience should land on. -
Check redirects outside WordPress: rules in your hosting panel or
.htaccessfile, your CDN, a domain forwarding service, link shorteners or campaign link tools in front of the site. TikTok’s click ID can be up to 1,000 characters long; nothing on the way should truncate it. -
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 only fires on the next page, the parameter is gone and the cookie is never written. On WordPress, a consent plugin that does not release the pixel on the same page, or an optimization plugin that delays or combines its code, are the usual reasons; 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; 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 your consent plugin keeps the cookie. After you click Accept,
ttclidand_ttpshould still be there on the next page. -
Pass the click ID to your server events. TikTok’s plugin does this itself from its
tiktok_ttclidcookie, together with_ttp; it keeps that cookie for 30 days. In your own Events API code, send the click ID asuser.ttclidand the_ttpvalue asuser.ttp. TikTok recommends keeping a stored click ID for 28 days or more and refreshing it when a new one arrives. -
Clear every cache (plugin, host and CDN) after changing redirects or settings, then test again while logged out.
Common causes
- Yoast SEO’s URL cleanup (or a similar option in another plugin) redirects
ttclidaway. - A redirect in the Redirection plugin is set to Ignore or Exact instead of Pass.
- Ads link to an old page, the non-canonical domain or a short link whose redirect drops the query string.
- A language redirect sends visitors to another URL without
ttclid. - The pixel only fires on the next page after consent, often because an optimization plugin delays or combines it.
- First-party cookies are turned off for the pixel.
How to verify the fix
- Repeat the test above with the exact ad URL, logged out: no redirect drops
?ttclid=test123, and after accepting cookies thettclidcookie holdstest123. - Open another page of the 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): 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): https://business-api.tiktok.com/portal/docs?id=1771100879787009 - TikTok API for Business, Send TikTok Cookie (_ttp) (
user.ttp): https://business-api.tiktok.com/portal/docs?id=1771100936446977 - TikTok Business Help Center, Using cookies with TikTok Pixel (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 Business Help Center, TikTok Pixel Helper (“First-Party Cookies Not Found”): https://ads.tiktok.com/resources/help/article/tiktok-pixel-helper-2.0?lang=en
- TikTok plugin source, version 1.4.2 (
tiktok_ttclidcookie set on the server for 30 days, sent with_ttpin Events API events): https://plugins.svn.wordpress.org/tiktok-for-business/trunk/pixel/Tt4b_Pixel_Class.php - WordPress Developer Resources,
redirect_canonical()(www, trailing slash and other canonical redirects): https://developer.wordpress.org/reference/functions/redirect_canonical/ - Redirection, Matching a URL (query parameters: exact, ignore, pass): https://redirection.me/support/matching-a-url/
- Redirection, Options (default query matching): https://redirection.me/support/options/
- Yoast, Advanced crawl optimization settings: URL cleanup (parameters never removed, logged-in users): https://yoast.com/help/advanced-crawl-settings-permalink-cleanup/
- WPML, Automatic redirect based on browser language: https://wpml.org/documentation/getting-started-guide/language-setup/automatic-redirect-based-on-browser-language/
- Polylang, Detect the browser preferred language: https://polylang.pro/documentation/support/guides/detect-the-browser-preferred-language/
More TikTok guides
- TikTok Pixel fires before cookie consent on WordPress
- TikTok Pixel not firing after cookie consent on WordPress
- Repeated TikTok event IDs drop real conversions: how to fix
- Duplicate TikTok Pixel events on WordPress
- TikTok Pixel event_id missing on WordPress and WooCommerce
- 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)