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.

  1. 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.
  2. Open developer tools (F12) on the Network tab and tick Preserve log, so redirects stay visible.
  3. 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.)
  4. If the first request is a redirect (301, 302, 307, 308), check its Location header. Does the new address still contain ttclid=test123?
  5. Accept the cookie banner, wait a few seconds, then go to Application > Cookies (Chrome) or Storage > Cookies (Firefox) and look for ttclid. It should hold test123. 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

  1. Link your ads to the final address. WordPress redirects other versions of an address to its canonical one: the http or https and www or non-www version 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.

  2. 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 ttclid may 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).

  3. 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 gclid and utm_ parameters, so ttclid is removed. It also removes nothing for logged-in users, which is why you may not have noticed. If it is on, add ttclid to 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.

  4. 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.

  5. Check redirects outside WordPress: rules in your hosting panel or .htaccess file, 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.

  6. Make sure the pixel runs on the landing page after consent. The pixel reads ttclid from 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”.

  7. 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”.

  8. Check that your consent plugin keeps the cookie. After you click Accept, ttclid and _ttp should still be there on the next page.

  9. Pass the click ID to your server events. TikTok’s plugin does this itself from its tiktok_ttclid cookie, together with _ttp; it keeps that cookie for 30 days. In your own Events API code, send the click ID as user.ttclid and the _ttp value as user.ttp. TikTok recommends keeping a stored click ID for 28 days or more and refreshing it when a new one arrives.

  10. 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 ttclid away.
  • 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

  1. Repeat the test above with the exact ad URL, logged out: no redirect drops ?ttclid=test123, and after accepting cookies the ttclid cookie holds test123.
  2. Open another page of the site: ttclid is still there.
  3. 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

More TikTok guides