Skip to content
FunnelGuard

Fix guide by FunnelsGuard

ttclid not stored or _ttp cookie missing: how to fix it

TRK-205Medium impactDetectedBy FunnelGuardPublished Updated
On this page

What this issue is

When someone clicks a TikTok ad, TikTok can append a click ID called ttclid to your URL, for example https://example.com/offer?ttclid=abc123. The TikTok Pixel reads it and stores it in the first-party cookie _ttp. TikTok uses these to link a later lead or purchase back to the ad click.

Why it costs you leads or sales

Your leads and sales still happen, but TikTok can't see which ads produced them. Reported conversions drop, campaigns look worse than they are, and TikTok's optimisation has less signal to find similar buyers. You may cut or pause ads that are really working.

Where attribution is lost
  1. TikTok ad clickURL has ?ttclid=...
  2. Landing pageRedirect or blocked pixel drops ttclid, no _ttp set
  3. Form or checkoutNo ttclid or _ttp to save
  4. Conversion eventTikTok can't match it to the ad

The click ID never reaches the conversion, so TikTok can't match it.

Conversions TikTok can seeExample numbers
Conversions TikTok can see (example)Real conversions: 100 conversions; Attributed (broken): 45 conversions; Attributed (fixed): 90 conversions038771004590Real conversionsAttributed (broken)Attributed (fixed)conversions

Example: 100 real conversions from TikTok ads, with and without ttclid and _ttp stored. Numbers are illustrative.

Common causes

Typical reasons ttclid or _ttp go missing
CauseWhat happens
Pixel not on the landing pageNothing reads ttclid or sets _ttp
Redirect strips query stringsttclid is gone before the pixel loads
Pixel waits for consent_ttp isn't set until the visitor accepts
Pixel loaded in a tag that never firesNo cookie, no events
ttclid not saved to a hidden fieldServer events and CRM have no click ID
Cookie cleared or blocked by browser_ttp missing on later pages

How to check if your site has it

Check manually in your browser
  1. Open your landing page with a test ttclid

    In a private window, visit your landing page URL with ?ttclid=test123 added. Accept cookies if a banner appears.

  2. Check the URL after load

    If ttclid disappears from the address bar and your page didn't remove it on purpose, a redirect is stripping it.

  3. Look for the _ttp cookie

    Open DevTools, then Application (Chrome) or Storage (Firefox), then Cookies. Look for _ttp on your domain.

  4. Check the pixel request

    In the Network tab, filter for tiktok and confirm requests to analytics.tiktok.com fire on page load.

  5. Submit a test lead

    Check whether the ttclid value reached your CRM or order record, if you store it.

How to fix it

The fix has three parts: make sure the TikTok Pixel loads on the landing page, keep ttclid through any redirects, and save the values with the lead or order so they can be sent later.

Fix by platform
  1. Add the TikTok Pixel base code

    Use the TikTok Pixel template or a Custom HTML tag with your pixel code. Trigger it on All Pages, including the landing page.

  2. Respect consent properly

    If you use a consent banner, make the tag fire once marketing consent is granted, and confirm it fires on the landing page after acceptance.

  3. Capture ttclid in a variable

    Create a URL variable (Query) with key ttclid. Use it to fill a hidden form field or a first-party cookie.

  4. Test in Preview mode

    Load the page with ?ttclid=test123 and confirm the tag fires and _ttp appears.

Save ttclid to a cookie and fill hidden fieldsjavascript
(function () {
  var params = new URLSearchParams(window.location.search);
  var ttclid = params.get('ttclid');
  if (ttclid) {
    var days = 90;
    var expires = new Date(Date.now() + days * 864e5).toUTCString();
    document.cookie = 'ttclid=' + encodeURIComponent(ttclid) + '; expires=' + expires + '; path=/; SameSite=Lax';
  }
  var match = document.cookie.match(/(?:^|; )ttclid=([^;]*)/);
  var saved = match ? decodeURIComponent(match[1]) : '';
  document.addEventListener('DOMContentLoaded', function () {
    document.querySelectorAll('input[name="ttclid"]').forEach(function (el) {
      el.value = saved;
    });
  });
})();
Keep the query string on a redirectnginx
# Nginx: $is_args$args keeps ?ttclid=... on redirect
server {
  listen 80;
  server_name example.com www.example.com;
  return 301 https://example.com$request_uri;
}

How to confirm it's fixed

Confirmation checks
  • Landing page with ?ttclid=test123 keeps the parameter in the URL after load
  • The _ttp cookie appears after the pixel loads (and consent, if required)
  • TikTok requests to analytics.tiktok.com fire on the landing page
  • The hidden ttclid field holds the value when the form is submitted
  • The test lead or order in your CRM or store contains the ttclid
  • TikTok Events Manager shows the event with browser and click ID matching

How to prevent it happening again

This usually breaks after a redirect rule, theme change, consent banner update or tag manager publish. Re-test a landing page with a test ttclid after each of those changes. Keep one owner for the pixel setup so it isn't installed twice or removed by accident.

How the problem often unfolds
  1. Day 1

    A new redirect rule is added for www and https.

  2. Day 2

    It drops the query string, so ttclid is lost on every TikTok click.

  3. Week 2

    TikTok reports fewer conversions and the campaign looks weak.

  4. Week 3

    The redirect keeps the query string and attribution recovers.

How FunnelGuard handles this

FunnelGuard detects this issue today. A robot visitor runs your real customer journey on a schedule, from the EU or the US, and checks the tracking hits sent to TikTok along the way. If the TikTok data needed for attribution is missing, you get a single alert with a screenshot and a likely cause. A failure is re-checked from a second region first, so a one-off glitch doesn't wake you up.

Test traffic is marked (utm_source=funnelguard, fg_test=1, an fg_test cookie and its own user agent), never clicks real ads and never bypasses consent banners or bot protection. You can start on the Free plan (1 site, 2 journeys, daily checks, no card), or run the free read-only website audit.

Questions people ask

What is ttclid and why does TikTok use it?

ttclid is the TikTok click ID added to your landing page URL when someone clicks a TikTok ad. TikTok uses it to match a later conversion, such as a lead or purchase, back to the exact ad click.

Why is my _ttp cookie missing?

The _ttp cookie is set by the TikTok Pixel, so it is missing if the pixel isn't on the page, is blocked, or is waiting for marketing consent. Check that the pixel loads on the landing page and that you accepted cookies in your test.

Why is ttclid disappearing from my URL?

Most often a redirect, such as http to https or www to non-www, drops the query string. Change the rule so it keeps the full query string, then test again with ?ttclid=test123.

How do I store ttclid with a lead?

Save the ttclid from the URL into a first-party cookie, then copy it into a hidden form field named ttclid. The value then arrives in your CRM with the lead and can be used for server-side events.

Do I need ttclid if I use the TikTok Events API?

It helps a lot. Sending the ttclid and the _ttp value with server events gives TikTok stronger signals to match the conversion to the ad click, alongside other allowed customer data.

Is it okay to store ttclid without consent?

That depends on your local privacy rules and your consent setup. Follow your consent banner choices and get legal advice if unsure. Don't bypass a visitor's decision to deny marketing cookies.

How can I test TikTok tracking on my landing page?

Open the page in a private window with ?ttclid=test123, accept cookies, and check DevTools for the _ttp cookie and TikTok network requests. A monitoring tool like FunnelGuard can repeat this check on a schedule.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.