Skip to content

TikTok Pixel before consent on WooCommerce: find and fix it

How to check whether your WooCommerce shop loads the TikTok Pixel before visitors accept cookies, why it happens and how to fix it step by step.

Lukas Kontur · · 8 min read

You connected your WooCommerce shop to TikTok ads, your cookie banner is in place, and the admin looks fine. Then a scan reports that the TikTok Pixel loads, or that the _ttp cookie is set, before anyone clicks "Accept". This guide shows you how to check that yourself in five minutes, why it happens on WooCommerce, and how to fix it without losing ad data from visitors who do accept.

The symptoms

  • A scan report lists a marketing cookie set before consent, usually _ttp, or requests to analytics.tiktok.com in the pre-consent section.
  • The TikTok Pixel Helper Chrome extension shows a pixel and a page event while your cookie banner is still open.
  • Your banner promises marketing cookies only after consent, but _ttp is already in your browser on the first page view.

You are not alone. In our scan of 97,304 EU websites, 18.3% (17,793 sites) set marketing cookies before the visitor made any consent choice (full study).

How to check it yourself (5 minutes)

You only need Google Chrome.

  1. Open a new private window (three-dot menu, "New Incognito window"). This gives you a visitor with no saved cookies and no earlier consent.
  2. Press F12 (Mac: Cmd + Option + I) to open DevTools before you load your shop. Click the Network tab and tick Disable cache.
  3. In the filter box, type tiktok.
  4. Load your shop. Do not touch the cookie banner.
  5. Look at the list. The pixel script is analytics.tiktok.com/i18n/pixel/events.js, the address used in TikTok's own pixel code (TikTok: pixel cookie consent mode). Any request to analytics.tiktok.com means the pixel started before consent.
  6. Open the Application tab, then Cookies and your shop's address. Look for the cookies TikTok lists for its pixel: _ttp, ttcsid and ttcsid_ followed by your pixel code, and ttclid when the visitor came from a TikTok ad (TikTok Ads Help: cookies with TikTok Pixel).
  7. Click a TikTok request and open the Initiator tab. If it points to your page itself (an inline script), a plugin or the theme printed the pixel code into the page. If it points to googletagmanager.com/gtm.js, your GTM container loaded it.
  8. Press Ctrl + U (Mac: Cmd + Option + U) to view the page source and search for ttq.load. If you find it more than once, the pixel is installed twice.
  9. Now click Reject (or "Decline") on your banner, reload and repeat steps 5 and 6. Nothing new from TikTok should appear after a rejection.

Why this happens on WooCommerce

In order of how often we see them:

  1. The pixel is added by a plugin your banner does not control. TikTok's official plugin (listed as "TikTok" on WordPress.org and as "TikTok for WooCommerce" on WooCommerce.com) installs the pixel and the Events API "with a click" (WordPress.org: TikTok). Neither that page nor the WooCommerce documentation describes a consent setting, so blocking it until consent is your consent plugin's job.
  2. Your consent plugin does not recognise the pixel. Consent plugins block the services they know and you have enabled. If TikTok is not switched on in your plugin, the pixel passes through.
  3. Google Tag Manager fires it without a consent rule. TikTok's official GTM template needs the pixel base code in a separate Custom HTML tag on All Pages (TikTok: GTM template). Without a consent setting on that tag, it fires for everyone.
  4. The pixel exists twice. For example once through the plugin and once through GTM or a snippet in the theme. You fix one copy and the other keeps firing.
  5. A caching or speed plugin delays your consent script. If the banner script runs after the pixel, it is too late to block it.
  6. Server-side events. The Events API sends events from your server to TikTok. You cannot see that traffic in DevTools, and the plugin's public pages do not say how it handles consent. Ask the plugin's support before you rely on it.

The fix

Step 1: keep one source of the pixel

Decide where the pixel lives: the TikTok plugin, GTM, or your own code. Remove the others. In WordPress, the plugin appears under Marketing, TikTok (same WordPress.org page). If you move the pixel to GTM, disconnect it in the plugin.

Step 2a: if you use Complianz

  1. Run the Wizard and, where it asks which social media or third-party services your site uses, select TikTok if your version lists it. Complianz blocks enabled services until consent (Complianz: integrating plugins).
  2. If the pixel still loads, add it in the Script Center (inside Integrations): under "Block a script, iframe or plugin", enter analytics.tiktok.com in "URLs that should be blocked before consent" and choose marketing (Complianz developer guide).
  3. Exclude complianz and cmplz from minify, combine, delay and defer in your caching plugin (Complianz: caching and optimisation plugins).

Step 2b: if you use CookieYes

  1. Check that your banner uses a consent type that blocks scripts. CookieYes documents that with "Info", "cookies are not blocked at all" (CookieYes: prior consent).
  2. On the same page, CookieYes describes adding a Script URL Pattern for scripts it does not block automatically. We suggest analytics.tiktok.com as the pattern and the category that covers advertising.
  3. Place the CookieYes script at the top of the page and exclude it from optimisation plugins (CookieYes troubleshooting).

Step 2c: if the pixel runs through Google Tag Manager

Open the Custom HTML tag that contains the TikTok base code, go to Advanced Settings, Consent Settings, choose "Require additional consent for tag to fire" and add ad_storage (Google: consent in Tag Manager). Do the same for every TikTok event tag. Your banner must update consent through Google Consent Mode for this to work; our GTM Consent Mode guide covers the details.

Step 2d: if you or a developer wrote the pixel code

TikTok documents a consent mode for its pixel (TikTok: pixel cookie consent mode). Add "holdConsent", "revokeConsent" and "grantConsent" to the ttq.methods list in the base code, then:

ttq.holdConsent();          // before ttq.load(): queue events, do not send them
ttq.load('YOUR_PIXEL_ID');
ttq.page();

// when the visitor accepts marketing:
ttq.grantConsent();
// when the visitor rejects:
ttq.revokeConsent();

Two things to know. First, in this mode the pixel script itself still loads before consent; TikTok describes it as holding events back, not as stopping the script or its cookies. If you want no request to TikTok at all before consent, block the script with steps 2a to 2c instead. Second, TikTok notes that ttq.revokeConsent() "does not affect data shared with the TikTok server" before that point.

In TikTok Events Manager, the pixel settings let you turn first-party cookie usage off (TikTok Ads Help: how to use cookies with TikTok Pixel). That changes which cookies the pixel uses; it does not make the pixel wait for consent. The same TikTok page asks advertisers to obtain consent and to stop cookies when consent is declined, through a tag manager, a consent platform or the pixel's consent mode.

How to verify the fix

Use a new private window for each run (close the old one first):

  1. Before any click: the Network filter tiktok shows nothing, and Application, Cookies shows no _ttp or ttcsid cookie. If you chose consent mode (step 2d), the pixel script will still load here, and a scanner will still report it; that is the trade-off of that option.
  2. After Reject and a reload: still nothing new from TikTok, on the homepage and on a product page.
  3. After Accept: requests to analytics.tiktok.com appear and _ttp is set. This proves you did not break tracking for visitors who agree.
  4. Add a product to the cart and check that the related TikTok request only appears after Accept.

If you want to use the TikTok Pixel Helper in the private window, switch on Allow in Incognito for it in Chrome's extension details, and switch it off again afterwards.

If step 3 shows nothing even after Accept, your consent plugin blocks the pixel but never releases it. Check that the category you used (marketing or advertisement) matches the button the visitor clicks.

Sample scan

78 / 100

High risk · Trackers: 23 · Pre-consent tracking: yes

See sample report →

For background, read Pre-consent tracking: what it is and why it matters. The same problem with Meta's pixel is covered in Meta Pixel fires before consent on WooCommerce.

Check your site in 1 minute

Our free scan opens your shop in a clean browser, records every request before and after the banner, and shows you exactly which pixel fired too early. No signup needed. Run a free scan.

Get alerted when it breaks

A plugin update can put the pixel back in front of the banner without anyone noticing. With monitoring, we re-scan your site on a schedule and email you when tracking before consent appears again. The free plan includes one monitored site with a weekly re-scan and email alerts. Create an account and add your site.

Last updated: