A cookie banner on Webflow only controls GTM tags when its choices are passed to Consent Mode v2.
If you want a Webflow cookie banner that your tags respect, the banner, GTM and Webflow’s own analytics all have to read the same choice. Here’s the setup I use on my demo site, webflow.kevinleary.net, with c15t as the banner.
Why Most Webflow Banners Fail
| Problem | Cause |
|---|---|
| Banner doesn’t block scripts loaded through GTM | The banner only blocks script tags in the page. Tags inside a GTM container never see it. |
| GA4 and Google Ads cookies set before consent | GTM loads before a default consent state exists, so tags start with no restrictions. I see this often with Finsweet Consent Pro setups. |
| GA tags don’t fire after a visitor accepts | The tag was blocked on page load and nothing tells GTM to try again once consent is granted. |
| Webflow’s analytics ignore the banner | Webflow tracking has its own on and off switch that the banner never touches. |
All four are fixed by the same thing: set the defaults before GTM loads, then pass every banner choice to both Google and Webflow.
Install GTM in Webflow
- Copy your container ID from Google Tag Manager. It looks like
GTM-XXXXXXX. - In Webflow, go to Site settings > Custom code > Head code.
- Paste the GTM snippet at the bottom of the field. The consent code in the next steps goes above it.
- Remove any GA4, Google Ads or pixel snippets hardcoded elsewhere on the site, so GTM is the only thing loading tags.
<script>
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXXX');
</script>
Add the c15t Cookie Banner
c15t is an open source consent banner with a standalone browser build, so it works on Webflow with a single script tag and no build step. Add it to the head code, above the GTM snippet:
<script src="https://cdn.jsdelivr.net/npm/@c15t/[email protected]/dist/c15t.local.js" data-categories="measurement"></script>
The data-categories attribute sets which categories the banner asks about. My demo site only runs analytics, so it only asks about measurement.
Don’t load the banner through GTM. It needs to be on the page before the container so the consent state is ready when GTM starts.
Connect c15t to Consent Mode V2 & Webflow Analytics
This script is the part that matters. It goes first in the head code, above the c15t script, and does three things:
- Sets the Consent Mode v2 defaults before GTM loads.
- Sends every c15t choice to Google with a consent update, plus a dataLayer event GTM can use as a trigger.
- Sends the same choice to Webflow’s built-in tracking with
wf.allowUserTracking()andwf.denyUserTracking().
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
(function(){
// Defaults: analytics on, but off in the EEA, UK and Switzerland
var eu = ['AT','BE','BG','HR','CY','CZ','DK','EE','FI','FR','DE','GR','HU','IE','IT','LV','LT','LU','MT','NL','PL','PT','RO','SK','SI','ES','SE','IS','LI','NO','GB','CH'];
gtag('consent', 'default', {ad_storage:'denied', ad_user_data:'denied', ad_personalization:'denied', analytics_storage:'granted', wait_for_update:500});
gtag('consent', 'default', {ad_storage:'denied', ad_user_data:'denied', ad_personalization:'denied', analytics_storage:'denied', region:eu, wait_for_update:500});
function wfDo(fn){ if (window.wf && wf.ready) { wf.ready(fn); } }
// Pass the visitor's c15t choice to Google and to Webflow
var rdy = false, last;
function sync(){
if (!rdy || !window.c15t || !c15t.hasConsented || !c15t.hasConsented()) { return; }
var ok = !!c15t.has('measurement');
if (ok === last) { return; }
var first = last === undefined;
last = ok;
gtag('consent', 'update', {analytics_storage: ok ? 'granted' : 'denied'});
if (!first || rdy === 2) { dataLayer.push({event:'c15t_consent', analytics_consent: ok ? 'granted' : 'denied'}); }
wfDo(function(){ if (ok) { wf.allowUserTracking({activate:true}); } else { wf.denyUserTracking(); } });
}
window.c15t = window.c15t || [];
c15t.push(['on', 'ready', function(){ rdy = true; sync(); rdy = 2; }]);
c15t.push(['on', 'consent', sync]);
// Webflow tracking stays off until a choice is made
document.addEventListener('DOMContentLoaded', function(){
wfDo(function(){ if (wf.getUserTrackingChoice() === 'none') { wf.denyUserTracking(); } });
});
})();
</script>
A few details worth knowing:
- The defaults are region based. Analytics starts as granted, except in the EEA, UK and Switzerland where it starts as denied. If you want opt-in everywhere, remove the first default line and the
regionfrom the second. - Ad consent stays denied. If you run ad tags, add a
marketingcategory to the banner and map it toad_storage,ad_user_dataandad_personalizationin the update call, the same waymeasurementmaps toanalytics_storage. - The
c15t_consentevent only fires when a visitor makes or changes a choice. A returning visitor’s saved choice is applied before GTM’s page load triggers run, so no extra event is needed. activate: truestarts Webflow tracking on the current page. Without it, tracking doesn’t begin until the next page view.
Custom code doesn’t run in the Designer, so publish the site before you test.
Categorize Tags in GTM
Consent signals only control tags that are set up to check them. In GTM, go to Admin > Container Settings, check Enable consent overview, then open the shield icon on the Tags screen to see which tags have no consent settings.
Then create one trigger: a Custom Event trigger with the event name c15t_consent. This is what lets a blocked tag fire right after a visitor accepts, without waiting for a second page view.
| Tag | Additional consent required | Triggers |
|---|---|---|
| Google tag (GA4) | analytics_storage |
Initialization (All Pages), c15t_consent |
| Google Ads, Meta Pixel, LinkedIn and other ad tags | ad_storage |
All Pages, c15t_consent |
| Hotjar, Clarity and other analytics tags | analytics_storage |
All Pages, c15t_consent |
| Webflow tracking (Custom HTML, below) | analytics_storage |
All Pages, c15t_consent |
For each tag, set the consent under Advanced Settings > Consent Settings > Require additional consent for tag to fire, and set Tag firing options to Once per page so two triggers never fire it twice.
Google’s own tags have built-in consent checks, so they can run without the additional requirement and send cookieless pings while consent is denied. I add the requirement anyway so that nothing is sent until the visitor agrees.
The last tag is a Custom HTML tag that turns on Webflow tracking wherever analytics consent is granted, which covers regions where the default is granted and the banner hasn’t been touched:
<script>
(function(){
if (window.wf && wf.ready) {
wf.ready(function(){ wf.allowUserTracking({activate: true}); });
}
})();
</script>
Testing
- Open the published site in a private window with GTM Preview running.
- Before touching the banner, check the Consent tab in Preview. The four Consent Mode v2 values should match your defaults, and no
_gacookie should exist where analytics is denied. - Accept in the banner. A
c15t_consentevent should appear,analytics_storageshould switch to granted, and your GA4 tag should fire on that same page. - Run
wf.getUserTrackingChoice()in the console. It should returnallowafter accepting anddenyafter rejecting.
For more on how the consent types work, see my guide to Consent Mode in Google Tag Manager. Once this is in place, tracking Webflow form submissions and loading HubSpot through GTM both follow the same consent categories.