Fix guide · Webflow · medium · about 30 min
TikTok Pixel fires before cookie consent on Webflow
For the finding “TikTok Pixel fires before cookie consent”. Also for: Any website, Shopify, WordPress, Framer.
What this means
Your Webflow site shows a cookie banner, but the TikTok Pixel sent data to TikTok while the banner was still waiting for an answer.
Webflow has no built-in TikTok integration: there is no Pixel ID field for TikTok in Webflow’s settings, so the pixel is always added by hand (custom code or a Code Embed), through Google Tag Manager (GTM), or by a third-party App. Webflow also has no cookie banner for third-party scripts; its own consent settings only cover Webflow Analyze and Optimize. The banner comes from a separate consent tool, and that tool only controls the scripts it knows about. TikTok’s standard base code ends with ttq.load(...) and ttq.page(), so a copy the tool does not control sends a page view the moment the page loads.
Why it costs you money:
- If you advertise to people in the EU, sending marketing data before consent is a legal risk you probably did not intend to take. We report the technical behaviour only; we cannot tell you whether your setup is compliant.
- The banner and the pixel are not connected. When this is fixed in a hurry, the usual result is the opposite problem: the pixel stops firing and your TikTok campaigns lose their data.
How to confirm it yourself
Our check runs from a browser in the EU. Consent tools on Webflow can show different banners per region, so if you are outside the EU, use a VPN or ask a colleague there. Consent Pro’s debugger (Test it on live website in the app) can also simulate an EU visitor.
- Open your published site on the domain your ads link to (not only the
webflow.iostaging address) in a private (incognito) window. - Open developer tools (F12), go to the Network tab and type
analytics.tiktok.com/apiinto the filter box. - Reload the page. Do not click the cookie banner.
- If requests to
analytics.tiktok.com/api/v2/pixelappear while the banner is still showing, the pixel fires before consent. In the payload,eventis the event name andcontext.pixel.codeis your pixel ID. - Under Application > Cookies (Chrome) or Storage > Cookies (Firefox), look for
_ttpandttclid. If your consent tool or GTM blocks the pixel (routes A and C below), these cookies before you answer the banner mean the same thing. TikTok does not document whether its consent mode (route B) also holds back cookies, so with that route judge by the event requests.
The TikTok Pixel Helper extension and Test Events in TikTok Events Manager show it too; the general guide has the details.
How to fix
-
Find every place the pixel is installed. Search the published page source for
analytics.tiktok.comandttq.load, then check:- Site settings > Custom code: the Head code and Footer code sections, and code added there by installed Apps.
- Page settings > Custom code (Inside
<head>tag and Before</body>tag) of individual pages, including CMS template pages. With Webflow Localization, check every locale: a locale whose page code was edited no longer follows the primary locale. - Code Embed elements on the canvas, including embeds inside components used on every page, and code in Rich text or CMS items.
- Your GTM container: TikTok Pixel tags and Custom HTML tags containing
ttq. - Third-party Apps from the Webflow Apps marketplace that add TikTok tracking. Pixelflow’s and Signal Beam’s listings, for example, say they run the TikTok browser pixel as well as the Events API. Check in the App how it connects to your banner.
The fix only works if every copy goes through your consent setup.
-
Pick one way to gate the pixel and remove the other copies.
A. Your consent tool blocks the base code. Paste TikTok’s base code into Site settings > Custom code > Head code, below your consent tool’s script, and let the tool hold it back:
- Consent Pro (Finsweet’s Webflow App): version 2 scans your site and blocks detected trackers automatically. After adding or changing the pixel, scan again, check that TikTok is listed under Marketing, and publish. If you turned on Load Script Async, mark the script yourself, as below.
- OneTrust App for Webflow: paste the base code into the App’s Blocked Scripts section (Manage blocked scripts), not into Webflow’s custom code. Webflow’s OneTrust guide says scripts placed directly in Webflow’s custom code keep firing before consent.
- Cookiebot (manual blocking):
type="text/plain"anddata-cookieconsent="marketing". - Others: follow the tool’s guide to blocking scripts before consent, using its marketing or advertising category.
For Consent Pro, a marked script looks like this:
<script type="fs-consent" fs-consent-categories="marketing"> /* TikTok Pixel base code from Events Manager, unchanged */ </script>type="fs-cc"withfs-cc-categoriesis the markup of Finsweet’s older Cookie Consent library and only works while that library is on the site.B. TikTok’s consent mode. Keep the base code unmarked in Head code, but change it in two places: add
"holdConsent", "revokeConsent", "grantConsent"to thettq.methodslist, and addttq.holdConsent();on the line beforettq.load(...). TikTok then queues events instead of sending them. Release them with a small script that your consent tool runs only after marketing consent, in Footer code. With Consent Pro:<script type="fs-consent" fs-consent-categories="marketing"> window.ttq && ttq.grantConsent(); </script>With Consent Pro, route A is the safer choice. Version 2 detects and blocks scripts automatically and loads released scripts asynchronously, so it may block the unmarked base code too, and the
grantConsent()script can run beforettqexists. If you use route B with Consent Pro, check after the scan that the base code is not blocked, and keep thewindow.ttq &&guard.With Cookiebot, use
type="text/plain" data-cookieconsent="marketing"instead.grantConsent()sends the queued events, including the first page view, so nothing is lost. Without it, the pixel never sends anything (see “TikTok Pixel does not fire after consent”).C. Google Tag Manager. Put the GTM snippet in Head code (do not mark the GTM snippet itself for consent) and install the pixel only through GTM; TikTok’s setup flow in Events Manager creates the tags for you. TikTok’s TikTok Pixel template has no consent fields of its own. In each TikTok tag, including the setup tag that loads the base code, open Advanced Settings > Consent Settings, choose Require additional consent for tag to fire and add
ad_storage. This only works if your consent tool sends Google Consent Mode updates to GTM; Consent Pro’s GTM template does, and its guide asks you to fire marketing and non-Google tags on itsconsent-updatedCustom Event trigger. -
Load the consent tool’s script first, at the top of Head code, above any TikTok code.
-
Publish to your custom domain, not only to the staging domain. Custom code changes do not go live until you publish.
Common causes
- The base code was pasted into Head code without the consent tool’s attributes, and the banner was added later.
- OneTrust is installed, but the pixel sits in Webflow’s custom code instead of the App’s Blocked Scripts.
- A second copy in a page’s custom code, a Code Embed, a component or a locale version of the page was never gated.
- Consent Pro: the pixel was added after the last scan or the site was not republished, or Load Script Async is on and the script was not marked by hand.
ttq.holdConsent()comes afterttq.load()andttq.page(), so the first page view has already left.- The pixel is in GTM, but the TikTok tags have no consent requirement. Consent Mode only controls Google tags automatically.
How to verify the fix
- In a private window on the published custom domain (from the EU or through a VPN): no
analytics.tiktok.com/api/v2/pixelrequests before you answer the banner, and, with routes A and C, no_ttporttclidcookies yet. - Click “Accept”: a page view request leaves within a few seconds, on the same page. In a fresh private window, click “Reject”: no page view or conversion events.
- Re-run the check on IsPixelWorking. The issue should be gone, and “TikTok Pixel does not fire after consent” should not appear in its place.
Questions people ask
Does Webflow have a TikTok Pixel integration?
No. Webflow’s own integration page says there is no native toggle for the TikTok Pixel; you add the base code as custom code or through GTM. Custom code and Code Embeds need a Core, Growth, Agency or Freelancer Workspace, or an active Site plan.
Does Webflow’s cookie consent setting control the TikTok Pixel?
No. Webflow’s consent settings and APIs apply to Webflow Analyze and Optimize. Third-party scripts such as the TikTok Pixel need a consent tool, TikTok’s consent commands or GTM consent settings.
Sources
- Webflow, TikTok integration (no native TikTok Pixel toggle, manual installation in Head code or GTM): https://webflow.com/integrations/tiktok
- Webflow Help, Custom code in head and body tags (plan requirement, Site settings and Page settings custom code, publish to go live): https://help.webflow.com/hc/en-us/articles/33961357265299-Custom-code-in-head-and-body-tags
- Webflow Help, Custom code embed (Code Embed element, plan requirement, embeds in components and rich text): https://help.webflow.com/hc/en-us/articles/33961332238611-Custom-code-embed
- Webflow Help, Localize page settings (per-locale custom code stops inheriting once edited): https://help.webflow.com/hc/en-us/articles/33961235760531-Localize-page-settings
- Webflow Developers, Working with custom code (scripts added by Apps): https://developers.webflow.com/data/docs/working-with-custom-code
- Webflow Developers, Site tracking and consent management (consent APIs apply only to Analyze and Optimize): https://developers.webflow.com/browser/reference/consent-management
- Webflow Help, Install and use the OneTrust app (Blocked Scripts; scripts in custom code still fire before consent): https://help.webflow.com/hc/en-us/articles/49624805369491-Install-and-use-the-OneTrust-app
- Webflow Help, Integrate Consent Pro for consent management: https://help.webflow.com/hc/en-us/articles/34394790067859-Integrate-Consent-Pro-for-consent-management
- Consent Pro Docs, Async script loading (
type="fs-consent",fs-consent-categories="marketing", scripts blocked until consent, released scripts load asynchronously): https://docs.consentpro.com/runtime/script-loading - Consent Pro Docs, Migration (v2 detects and blocks scripts automatically): https://docs.consentpro.com/webflow/migration
- Consent Pro Docs, Debugger (region simulation): https://docs.consentpro.com/webflow/debugger
- Consent Pro Docs, Google Tag Manager setup (
consent-updatedtrigger, additional consent checks): https://docs.consentpro.com/webflow/google-tag-manager - Finsweet Cookie Consent README (legacy
type="fs-cc"markup): https://cdn.jsdelivr.net/npm/@finsweet/cookie-consent@1/README.md - Cookiebot Support, Manual cookie blocking (
data-cookieconsent="marketing"): https://support.cookiebot.com/hc/en-us/articles/4405978132242-Manual-cookie-blocking - Webflow Apps, Pixelflow Meta & TikTok Pixel (third-party; installs browser pixels and sends TikTok Events API events): https://webflow.com/apps/detail/pixelflow-fb-conversions-api-multi-pixel
- Webflow Apps, Signal Beam (third-party; TikTok Pixel plus Events API, consent mode): https://webflow.com/apps/detail/signal-beam
- TikTok API for Business, Pixel Cookie consent mode (
ttq.methods,holdConsentbeforettq.load, queued events sent ongrantConsent): https://business-api.tiktok.com/portal/docs?id=1795929012554754 - TikTok API for Business, Install Pixel using code (base code with
ttq.loadandttq.page): https://business-api.tiktok.com/portal/docs?id=1739585702922241 - TikTok Business Help Center, Using cookies with TikTok Pixel (
_ttp,ttclid, advertising cookies): https://ads.tiktok.com/resources/help/article/using-cookies-with-tiktok-pixel?lang=en - TikTok Business Help Center, Get started with Google Tag Manager (set up from Events Manager): https://ads.tiktok.com/resources/help/article/get-started-google-tag-manager?lang=en
- TikTok on GitHub, TikTok Pixel GTM template (no consent fields): https://github.com/tiktok/gtm-template-pixel
- Google Tag Manager Help, Tag Manager consent mode support: https://support.google.com/tagmanager/answer/10718549