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.

Consent behaviour

Category: marketing.

Common cookies: _ttp.

Common requests: analytics.tiktok.com.

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

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.