In this article
A Webflow site has no template file to edit. Analytics goes in through the site's custom code settings, and it reaches visitors the next time you publish. Before that, check two things: whether your plan allows custom code, and whether Webflow already counts what you want to know.
This guide covers both, then where the script goes, what publishing changes and how to test it. The steps work for any analytics tool that installs with a script tag. The Webflow details come from its help center, as of November 2026.
Check your plan first
Webflow's help page on custom code says it's available with a Core, Growth, Agency or Freelancer Workspace, or on a site with an active Site plan, and that Site managers and Designers can add it. A free site in a free Workspace has neither, so the custom code fields aren't open to it.
Google Analytics is the exception. Webflow has a Measurement ID field for it that works without a paid plan. Other script-tag analytics tools need custom code.
What Webflow already offers
Webflow has two ways to count visitors without a separate script tag:
The Google Analytics field
Under Site settings → Integrations → Google Analytics, you paste a GA4 measurement ID, save and publish. Webflow's help page says the integration loads Google's tag through Google Tag Gateway, to reduce the effect of ad blockers. Google Analytics sets first-party cookies such as _ga, which brings back the question of a cookie banner.
Webflow Analyze
Webflow's own analytics is a paid add-on that a Workspace admin buys. It records clicks on buttons, links and forms, unique visitors, sessions, bounce rate and time on page, with goals for clicks and up to 90 days on screen at once. According to Webflow, it doesn't use cookies to recognise visitors but does use local storage, and its opt-in and opt-out modes need a consent management tool.
Add the script in Site settings
Sign up for the tool you picked, add your site using the domain visitors actually see, and copy the snippet it gives you, usually a single <script> tag shaped roughly like this:
<script defer src="https://analytics.example.com/script.js" data-site="YOUR-SITE-ID"></script>That's a placeholder, not a working tag. Copy the exact one from your tool and don't change its attributes. Then, in Webflow:
- Open the site's Site settings and go to the Custom code tab.
- Paste the tag into Head code. Webflow puts that code just before
</head>on every page of the site. Footer code ends up just before</body>. Use it only if your tool asks for it. - Click Save changes.
If the field already holds other code, paste the tag on a line of its own, outside any other script or comment. Don't add <html>, <head> or <body> tags, which Webflow warns can break the layout. Each field takes up to 50,000 characters. Webflow also notes that external scripts in the head can slow page loads. A tag with defer or async downloads while the page keeps rendering, which is why most analytics tags carry one of them.
Publish, and know where it runs
Saving doesn't put the code on your live site. Webflow says custom code takes effect in preview and comment modes, but only goes live when the site is published. It doesn't run in the expand canvas view.
When you click Publish, you pick the domains. A Webflow site can be published to its staging subdomain, such as yoursite.webflow.io, and to custom domains. Webflow calls the staging subdomain useful for testing custom code before the site goes live on the custom domain. To publish to staging only, tick the webflow.io address, untick the custom domain and publish to the selected domains.
So the script runs in more places than the live site: in preview, in comment mode and on staging. Unless your tool only counts the domain you registered with it, your own previews and staging visits end up in the numbers. Webflow has a marker for the preview part. Code wrapped like this is left out of preview and comment modes:
<!-- EXCLUDE FROM PREVIEW: START -->
<script defer src="https://analytics.example.com/script.js" data-site="YOUR-SITE-ID"></script>
<!-- EXCLUDE FROM PREVIEW: END -->For staging, register your custom domain in the tool rather than the webflow.io address, and filter by hostname if the tool lets you.
Saving puts the code in Webflow. Publishing puts it on your site.
Page settings: one page only
Each page also has a Custom code section in its Page settings, opened from the Designer, with an Inside <head> tag field and a Before </body> tag field. Code there only runs on that page, after the site-wide code. It suits a script that belongs on one landing page. For analytics it leaves every other page uncounted, and the same tag in both places loads twice on that page.
Test on the published site
Publish, then do this on the live site, not in the Designer:
- Open your custom domain in a private window, with any ad or tracker blocker turned off for the test.
- View the page source and search for the script's address. If it isn't there, check that you published to this domain after saving, and that the tag went into Site settings rather than one page's settings.
- Open the developer tools, go to the Network tab and reload. Filter by your tool's domain. You should see the script load, and usually a second request that sends the pageview. A blocked request is marked as an error.
- Open the tool's live or real-time view, if it has one, and look for your visit.
- Click through two or three pages using the site's own links, and check that each one shows up as its own pageview.
If the numbers look wrong
- Nothing in the page source. The site wasn't published to this domain after saving, the code went into one page's settings, or the plan doesn't include custom code.
- In the source, but nothing loads. A blocker stopped it, or the tag broke on the way: curly quotes, a missing
</script>, or the tag pasted inside another tag. - The script loads, but no visits appear. The tool expects one domain and you tested on another, such as the
webflow.ioaddress when you registered your custom domain. - Everything counted twice. The tag is in Site settings and in a page's settings, or Google Analytics is in both the Integrations field and the head code, which Webflow's help page advises against. Remove one.
- Visits nobody made. Your own previews and staging visits, if the tool counts every hostname. See the section on publishing above.
- Two tools disagree. They will, by a margin. Check that both rise and fall on the same days, and read why no two analytics tools agree on your traffic for where the gaps come from.
Does the site still need a cookie banner?
A cookie-free analytics script removes one reason for a banner. The rest of the site can still add others: Google Analytics sets cookies, Analyze uses local storage, and embedded videos, chat widgets and some fonts bring their own. To see what your published site stores, open the developer tools, clear the site data, browse a few pages and look under Cookies and Local storage. Whether you can drop the banner depends on that whole list, and what it takes to run a website without a cookie banner goes through it.
If you plan to send campaign traffic to your Webflow pages, tag the links the same way from the first day. A small UTM naming system keeps those reports readable.
The short version
- Check that your Workspace or Site plan includes custom code.
- Decide whether Analyze or the Google Analytics field already covers you.
- Site settings → Custom code → Head code, then Save changes.
- Publish, and remember that preview and staging run the code too.
- Not in Page settings as well.
- Test on the live domain by clicking through several pages.
Lomen is one of the tools you could add this way, as one script tag in Webflow's Head code, with no API key, package or build step. Pageviews only count from the domain you added and its subdomains, so with your custom domain added, the webflow.io staging address and Webflow's previews stay out of the numbers. A second copy of the tag for the same site does nothing, so a duplicate in a page's settings can't double the count. It sets no cookies, never stores IP addresses and by default keeps nothing in the visitor's browser. It groups visits from nine AI assistants by referrer and utm_source, and Lomen AI, a chat in the dashboard, answers questions about your own figures. It has no custom events or funnels, so for clicks on buttons, links and forms, Analyze, or Google Analytics with those clicks set up as events, is the closer fit. Lomen is free during the public beta.