All posts
Web design & development

Google Tag Manager on Webflow: Clean Setup and Data Layer Events

Set up Google Tag Manager on Webflow cleanly: one install, data layer events for forms and CTAs, consent handled first, and a Preview test before publish.

By Mehdi Hassan9 min read

The short answer

To set up Google Tag Manager on Webflow, paste the container snippet once into Site settings custom code, remove any duplicate Google Analytics install, then push data layer events for form successes and key CTA clicks from a small site-wide script. Load your consent default before other tags, and test every event in GTM Preview on the published site.

Key takeaways

  • Install the GTM container once in Site settings, and turn off Webflow's native GA integration if GTM sends GA4.
  • Webflow forms don't push data layer events, so fire your own event when the success message appears.
  • Track successes, not button clicks: a click on submit also fires when validation fails.
  • Custom code runs on the published site, not in the Designer, so test on staging or the webflow.io domain.
  • Consent defaults must load before every other tag, including on Webflow's staging subdomain.

Part of GA4 Setup for Marketing Websites: The Complete Guide

Webflow makes it easy to add tracking and just as easy to add it twice. This guide covers the Webflow-specific parts of a clean setup. For containers, naming and permissions in general, start with our Google Tag Manager setup guide for startups, and for the reporting side, our GA4 setup guide for marketing websites.

How do you add Google Tag Manager to Webflow?

You add Google Tag Manager to Webflow by pasting the container's two snippets into the site-wide custom code fields in Site settings: the script in the head code and the noscript part at the start of the body (Webflow's footer field is the closest fit, and the noscript fallback matters little for modern browsers). Publish, and the container loads on every page.

Put it in Site settings, not in a page's custom code or an Embed element, so every page and CMS template gets exactly one copy. Custom code fields depend on your Webflow site plan, so check Webflow's current plan page if the fields are locked. Use a company-owned Google account for the container and add a second admin, so tracking doesn't leave with a freelancer.

Should you use Webflow's native Google Analytics integration or GTM?

Use one or the other, never both. Webflow's built-in Google Analytics integration is fine if GA4 page views are all you need. As soon as you want form conversions, ad pixels or consent rules, move GA4 into GTM and clear the measurement ID from Webflow's integration settings.

Setup

Good for

Limits

Webflow native GA integration

Basic page views on a brochure site

No custom form events, no other tags, consent handled elsewhere

GTM in Site settings custom code

Most startup marketing sites

Needs an owner and naming rules

Both at once

Nothing

Double-counted page views and sessions

Tags pasted into page embeds

Nothing

Missed pages, duplicates on templates, hard to audit

If you're not sure what's installed today, open the published site, open DevTools, filter the Network tab for collect requests and load one page. More than one GA4 page view request per load means a duplicate. Our guide to GA4 not tracking conversions covers the other symptoms.

How do you track Webflow form submissions with GTM?

Track Webflow form submissions with GTM by pushing a data layer event when the form's success message becomes visible, then using that custom event as the only trigger for your conversion tags. Webflow's native forms don't push data layer events themselves, and GTM's built-in form trigger often misfires because Webflow submits forms with JavaScript.

When a native Webflow form submits successfully, Webflow hides the form and shows its success state (the Success message block). A short site-wide script can watch every form wrapper and push an event like generate_lead the moment that block appears. Include the form's name and the page path as parameters, so one event covers every form on the site.

  1. Name every form in the Designer

    Give each form a clear name in its settings, such as demo-request or newsletter. That name becomes your form_name parameter, so reports can tell the forms apart.

  2. Add one listener script site-wide

    In Site settings footer code, add a script that observes each form block and pushes dataLayer.push({event: 'generate_lead', form_name: ..., page_path: ...}) once its success message is shown.

  3. Create the trigger in GTM

    Add a Custom Event trigger for generate_lead and Data Layer Variables for form_name and page_path. Name them to your convention, such as Trigger - CE - generate_lead.

  4. Attach your tags

    Point the GA4 event tag and any ad conversion tags at that one trigger. Mark generate_lead as a key event in GA4, but only for forms that are real leads.

  5. Test in Preview on the published site

    Submit a real test entry, confirm the event shows once in Tag Assistant with the right parameters, then submit a broken entry and confirm nothing fires.

What about embedded forms like HubSpot or a scheduler?

Third-party forms embedded in Webflow don't show Webflow's success state, so the listener above won't see them. Most form and scheduling tools send a browser message or a callback when a submission or booking completes. Listen for that event in your site-wide script and push the same kind of data layer event, with a different form_name.

For example, suppose your demo form is a HubSpot embed and bookings run through a scheduler. You'd push generate_lead from the form's submit callback and book_meeting from the scheduler's booking-confirmed message. Check each vendor's current developer docs for the exact event name, because these change. Our conversion tracking guide for lead-gen websites covers which outcomes deserve to be key events.

How do you build a Webflow data layer for CTA clicks?

Build a Webflow data layer for CTA clicks by tagging important buttons with a custom attribute in the Designer and pushing one generic cta_click event with the attribute's value. That way marketers add tracking to a new button in Webflow, without touching GTM or code.

In Webflow, select a button, open its element settings and add a custom attribute such as data-track with a value like pricing-hero-demo. The site-wide script listens for clicks on any element with that attribute and pushes cta_click with the value as a cta_name parameter. In GTM, a single trigger and a single GA4 event tag cover every tracked button.

  • Track intent, not everything. Hero CTAs, pricing plan buttons and the main nav demo button are worth it; footer links usually aren't.
  • Use stable values. Name by location and purpose, not by button text, so a copy change doesn't break reports.
  • Keep CTA clicks diagnostic. They explain the path to a lead, but they are not conversions and shouldn't be key events.
  • Write it down. Add every event and parameter to a website tracking plan so the next person knows what exists.

Handle consent on Webflow by loading your consent management platform through GTM's Consent Initialization trigger, or directly in the head code above the GTM snippet, so default consent states exist before any Google tag fires. The banner then sends an update when the visitor chooses, and tags respond to it.

The Webflow-specific risks are timing and duplication. A cookie banner installed from a Webflow app or embed, plus a CMP template inside GTM, can set conflicting defaults. Pick one path and remove the other. Also check the webflow.io staging domain: if it's publicly reachable, tags fire there too, so either apply the same consent setup or exclude the staging hostname in your triggers.

Our Consent Mode v2 guide explains the four parameters, the basic versus advanced choice and the race conditions that quietly delete conversions. Decide the mode with whoever owns privacy for the business before you build.

How do you test GTM on a Webflow site before publishing?

Test GTM on a Webflow site by publishing to the webflow.io staging domain, opening GTM Preview against that URL and walking through every tracked action: page load, each form success, each failed form, each tracked CTA and the consent choices. Only publish the GTM container version after every event shows once with the right parameters.

  1. Page load: one GA4 page view, with the consent state set on the first event.
  2. Form success: generate_lead fires once, with the right form_name and page_path.
  3. Form failure: submit with a missing required field and confirm nothing fires.
  4. CTA clicks: each tagged button pushes cta_click with its own cta_name.
  5. Consent: rejected visitors don't trigger marketing pixels; accepted visitors do.
  6. GA4 DebugView: events arrive with parameters you can register as custom dimensions.

Write a short version note in GTM for every publish, and repeat the checklist whenever a form, template or banner changes. Tracking breaks most often during redesigns and platform moves, which is why our analytics continuity plan for migrations lists every event to rebuild and retest.

What usually breaks Google Tag Manager on Webflow?

Google Tag Manager on Webflow usually breaks when someone changes the site without re-testing tracking: a renamed form, a new form block pasted from another page, a CMS template rebuilt from scratch or a second analytics install added through a Webflow app. None of these produce an error, so conversions just drop.

  • Duplicated forms keep old names, so two forms report as one.
  • New templates miss the attribute on their CTAs, and clicks stop appearing.
  • A Webflow app adds its own GA4 tag next to the one in GTM.
  • Staging traffic from the webflow.io domain mixes with production data.
  • Heavy tags in the container slow interactions; see our Core Web Vitals fixes for Framer, Webflow and Next.js.

A quarterly review of the container, and a monthly look at key events by form in a marketing website KPI dashboard, catches most of these. For more on what we set up as a GTM integration, see our Google Tag Manager integration page.

Frequently asked questions

Does Webflow have a built-in data layer?
Webflow doesn't push form or interaction events to a data layer on its own. GTM creates the dataLayer array when it loads, and your site-wide script adds events to it. That's why a small listener for form successes and tagged CTA clicks is part of every Webflow tracking setup we build, alongside GA4's own automatic page view.
Can I track Webflow form submissions without GTM?
Yes. You can call the Google tag directly from a custom code script when the success message appears, sending a generate_lead event to GA4. It works for GA4 alone, but once you add ad conversion tags or consent rules you'll want GTM, so one event can feed every platform from one trigger.
Why does GTM Preview not connect to my Webflow site?
Usually because the container isn't on the URL you're previewing. Custom code only runs after publishing, so publish to the domain you're testing, check the GTM ID in Site settings matches the container, and disable ad blockers or privacy extensions in the test browser, since they can block the debug connection.
Should the staging webflow.io domain be tracked?
It's best kept out of production data. Either add a trigger condition so tags only fire on your custom domain, or filter the staging hostname in GA4. Keep GTM installed on staging, though, so you can test events in Preview before publishing changes to the live site.
Do I need a developer to set up GTM on Webflow?
Not for the install, which is a paste into Site settings. The form listener and CTA script are short, but they're code, and getting timing, duplicates and consent right is where setups go wrong. Many teams have a developer build it once, then let marketers add tracked buttons through custom attributes.

· CEO & Design Director

Copywriter, designer and developer, and founder of Designify Studio. Over five years, 60+ projects across 14+ industries, for startups that have raised $300M+.

Want this done for you? Monthly retainer, $6,000.

Your ongoing design and development team, for products that keep shipping. $6,000, per month, flat fee. Book a free 30-minute call to see if it fits.

Schedule Call