Integrations
TikTok PixelTikTok Pixel
preset documentationDocumentation

CookiePilot TikTok Pixel preset: _ttp and marketing events after consent

TikTok Pixel collects marketing data, so it should wait for marketing consent. The preset helps block _ttp and analytics.tiktok.com before the user's choice and start events only after acceptance.

Overview

TikTok Pixel collects marketing data, so it should wait for marketing consent. The preset helps block _ttp and analytics.tiktok.com before the user's choice and start events only after acceptance.

Category

marketing.

Trace

_ttp.

Trace

analytics.tiktok.com.

Consent behaviour

No _ttp before consent.

After Reject, no TikTok requests.

After Accept, events are not duplicated.

Setup steps

Move the pixel into GTM or a consent-gated layer.

Require marketing consent.

Test the product page and thank-you page.

Example snippet

Example snippet

Example snippet
<!-- TikTok Pixel after marketing consent. Replace TIKTOK_PIXEL_ID. -->
<script>
window.addEventListener('cookiepilot:consent', function (event) {
  var consent = event.detail || {};
  if (!consent.marketing || window.__tiktokPixelLoaded) return;
  window.__tiktokPixelLoaded = true;

  !function (w, d, t) {
    w.TiktokAnalyticsObject=t;
    var ttq=w[t]=w[t]||[];
    ttq.methods=['page','track','identify','instances','debug','on','off','once','ready','alias','group','enableCookie','disableCookie'];
    ttq.setAndDefer=function(t,e){t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}};
    for(var i=0;i<ttq.methods.length;i++)ttq.setAndDefer(ttq,ttq.methods[i]);
    ttq.load=function(e){var s=d.createElement('script');s.async=true;
      s.src='https://analytics.tiktok.com/i18n/pixel/events.js?sdkid='+e+'&lib='+t;
      d.getElementsByTagName('script')[0].parentNode.insertBefore(s,d.getElementsByTagName('script')[0]);
    };
    ttq.load('TIKTOK_PIXEL_ID');
    ttq.page();
  }(window, document, 'ttq');
});
</script>

Test checklist

No _ttp before consent.

After Reject, no TikTok requests.

After Accept, events are not duplicated.

Setup steps

  1. 1Move the pixel into GTM or a consent-gated layer.
  2. 2Require marketing consent.
  3. 3Test the product page and thank-you page.

Test checklist

  • No _ttp before consent.
  • After Reject, no TikTok requests.
  • After Accept, events are not duplicated.

FAQ

Is this legal advice?

No. It is an implementation guide. For unusual data flows, confirm the setup with your legal or privacy team.

Does CookiePilot block every script automatically?

CookiePilot supports autoblocking and Consent Mode. Trackers hardcoded before the CMP still need to be moved behind the stub or into GTM Consent Initialization.

Related integrations

See the setups that most often appear together with this integration.

Ready to configure it?

Start CookiePilot, choose the right integration and verify that tags wait for user consent before they run.