Adding Custom Code to the Head of a Webflow Site
Analytics, heatmap and pop-up tools usually ask for one thing: put a short script in the <head>of every page. On Webflow you don't drop it onto the canvas. You add it once in Site settings > Custom code, and then you publish. This guide covers the plan requirement Webflow documents today, the difference between head code, footer code and page-level code, why your script may seem to do nothing in the Designer, and how to check that it really loads on your live site.
Updated

Before you start: what Webflow requires
Custom code is a paid feature on Webflow, but the rule has two parts, because Webflow has both Workspace plans (for your account or team) and Site plans (for each individual site). Webflow's help article on custom code says it is available on "Core, Growth, Agency, or Freelancer Workspaces, or sites with an active Site plan." In other words, either a paid Workspace or a paid Site plan on the site you are working on unlocks it.
| Requirement | Why it matters | How to check |
|---|---|---|
| A paid Workspace (Core, Growth, Agency or Freelancer) or an active Site plan on this site | Custom code in Site settings is only available on these plans. | Check the plan shown for your Workspace and for this site in your Webflow Dashboard. A Site plan on a different site doesn't count. |
| The right role | Webflow says Site managers and Designers can add custom code. | If you can't edit the Custom code fields, ask the Workspace owner about your role. |
| A way to publish the site | Custom code only goes live when the site is published. | Make sure you are allowed to publish, or line up someone who is. |
| The snippet from your tool | You paste it exactly as your tool provides it. | Copy it straight from your tool's dashboard. Don't retype it. |
Plan names and prices change, so we don't list prices here. Check the options in your own Webflow account. What matters for this guide is that one of the two conditions above is true for the site you want to track.
Have the script ready before you open Webflow. In marketingLABO, for example, you register your site with its name and URL, and the dashboard then shows your tracking tag with a Copy tag button and the instruction to paste it right before </head> on every page. On Webflow, that is exactly what the Head code field in Site settings does, as you will see in Step 2.
<script src="https://...your tag..."></script>. Always paste the exact snippet from your own tool's dashboard, not this example.Three places for code in Webflow
Webflow gives you three different places to add code, and choosing the right one is most of the job:
| Where | What it does | Use it for a tracking tag? |
|---|---|---|
| Site settings > Custom code (Head code or Footer code) | Adds code to every page of the site. Head code goes before the closing </head>; footer code goes just before the closing </body>. | Yes. This is the route for a tag that should be on every page. |
| Page settings > Custom code | Adds code to one page only, in a field for inside the <head> tag or one for before the </body> tag. | Only if your tool tells you to install on a single page. |
| Code Embed element | Places code inside a specific section of a page on the canvas. | No. It is for content in a particular spot, such as an embedded widget. |
For a visitor analytics, heatmap or pop-up tag that should run on every page, use the site-wide Head code field. Adding the tag to each page individually takes longer, and pages you create later would be missed.
Step 1: Open Site settings > Custom code
- Sign in to Webflow and open the Site settings of the site you want to track.
- Open the Custom code tab.
- You will see two sections: Head code and Footer code. If they are missing or locked, recheck the plan and role requirements above.
Before you paste anything, read what is already in both sections. Sites that have been around for a while often have old snippets from tools nobody uses any more, or a copy of the same tool you are about to install.
Step 2: Paste the snippet into Head code
- Click into the Head code section and paste the snippet exactly as your tool gives it, including the opening and closing
<script>tags. - If there is already code there, put your snippet on a new line after it. Don't paste into the middle of another snippet.
- Add a comment above it so your team knows what it is, for example
<!-- marketingLABO tag, added Oct 2026 -->. Webflow's custom code fields accept HTML, so an HTML comment is fine, and it makes the code easy to find later. - Click Save changes.
Webflow says Head code "appears before the closing head tag" in your site's HTML markup and applies to your entire site. That matches the "right before </head> on every page" instruction many tools give, including marketingLABO, so you don't need anything else for site-wide installation.
Paste the snippet once. If the same tool is also installed in Footer code or in a page's settings, page views can be counted twice.
Head code or Footer code?
Webflow's article gives a performance tip for footer code: placing script tags before the closing body tag lets the page load its content before the JavaScript is processed. For external scripts in the head, Webflow suggests using the async or defer attribute. Here is how that applies in practice:
| Section | Where the code ends up | Typical use |
|---|---|---|
| Head code | Before the closing </head> on every page | Analytics, heatmap and pop-up tags; tools that need to start as the page loads |
| Footer code | Just before the closing </body> on every page | Scripts that interact with page elements, or that your vendor says can wait |
The rule that beats both: follow your vendor's instructions. If your tool asks for the head, use Head code. marketingLABO asks for its tag right before </head>, so choose Head code. Don't add async or defer to a vendor's snippet yourself; most tracking snippets already decide how they load, and changing the snippet can change when it runs.
Step 3: Publish the site
This is the step people miss. Webflow's help article says the effects of custom code appear in preview mode, but they won't go live until your site is published. Webflow's developer documentation says the same thing about custom code added by apps: "the change only takes effect when the site is published."
- After saving the custom code, publish your site.
- Make sure you publish to the domain your visitors actually use. If your site is published to more than one address, test the one you registered in your tool.
- Remember that publishing pushes all staged changes live, not just the code. If a teammate has unfinished design changes on the site, coordinate with them before you publish.
Until you publish, visitors to the live site don't get the script, and your tool won't receive any data from them.
Why your script seems to do nothing in the Designer
It is common to paste a tag, look at the canvas and conclude it didn't work. Webflow documents why. Its help center says custom code doesn't run in the expand canvas view, and that the effects show up in preview mode but go live only on publish.
For a tracking tag this matters even less, because a tag has nothing to show on the canvas anyway. The test that counts is the published site in a normal browser window, which we cover in Step 4.
Page-level custom code: when you need it
Sometimes you do want code on only one page, for example a conversion script your vendor tells you to place only on a thank-you page. For that, Webflow has custom code fields in Page settings:
- Open the site in the Designer.
- Open Page settings for the page.
- Find the Custom code section, with one field for code inside the
<head>tag and one for code before the</body>tag. - Paste the code, save, and publish.
Webflow notes that page-level code appears after any site-wide custom code in the HTML. So if a page-level script depends on your site-wide tag, it will find the tag already in place.
For marketingLABO you don't need page-level code at all. The site-wide tag covers every page, and goals such as reaching a specific thank-you page are set up in the marketingLABO dashboard as micro-conversions, not with extra code.
Step 4: Check that it works on the live site
- Open your published site in a private window, at the domain your visitors use. A private window shows the site the way a new visitor sees it.
- View the page source (Ctrl+U on Windows, Option+Cmd+U in Chrome on Mac) and search for a recognizable part of your snippet, such as its domain. It should appear inside the head, before
</head>. - Click through three or four pages, including a CMS item page such as a blog post if your site has them. Site-wide head code should be on all of them.
- Use your tool's own check. In marketingLABO, open any page of your site, then press Check tracking in the dashboard. If nothing has arrived, the dashboard suggests confirming the tag is right before </head> on every page and your changes are saved (published), then reloading your site and trying again.
After a few minutes of browsing, look for your own visit in the tool. In marketingLABO, the visitor history timeline should list each page you opened, in order.
If you later move the site to a new custom domain, check the tag again on the new address the same day. In marketingLABO, the site URL you registered should also match the domain visitors actually use, so update it there too.
Limits worth knowing
| Limit | What Webflow says | What it means for a tracking tag |
|---|---|---|
| Size | The Head and Footer sections can each hold up to 50,000 characters. | A normal tag is far below this. For very long scripts, Webflow suggests hosting the file elsewhere and referencing it. |
| Languages | The custom code sections only support HTML, CSS and JS; server-side languages such as PHP, Python or Ruby aren't allowed. | Tracking snippets are JavaScript, so this is fine. |
| Support | Webflow's support team is unable to provide direct help with custom code setup or troubleshooting. | For tag problems, contact your tool's provider. Webflow points users to the Webflow Forum for custom code questions. |
| Downgrades | If a Site plan is downgraded to Starter and the site isn't in a paid Workspace, you can't view or edit its custom code until it is on a paid Site plan again. | Keep a copy of every snippet outside Webflow so you are never locked out of your own setup. |
If the tag doesn't load: a troubleshooting table
| Symptom | Likely cause | What to do |
|---|---|---|
| Custom code fields are missing or locked | Neither a paid Workspace nor an active Site plan applies to this site, or your role can't edit them | Check the plans for this site and Workspace, and your role. |
| Code is saved but not in the live page source | The site hasn't been published since you saved | Publish the site, then reload in a private window. |
| Code is on the live site but not on one address | You published to some addresses but are testing another | Publish to the domain you are testing, or test the one visitors use. |
| Nothing happens in the Designer | Custom code doesn't run in the expand canvas view | Expected. Test the published site. |
| Visits are counted twice | The same tool is in Head code and Footer code, or in Page settings too | Keep one copy per tool, in Head code. |
| Tag appears only on one page | It was added in Page settings instead of Site settings | Move it to Site settings > Custom code > Head code. |
| Snippet is present but the tool reports errors or nothing | Typo from retyping, a browser extension blocking it, or a conflict with another script | Open the browser console for errors, try a browser without blockers, re-copy the snippet, and contact the tool's provider. |
When you suspect another snippet is causing trouble, remove snippets one at a time from a copy you have saved elsewhere, publish, and test after each change. Because Webflow doesn't offer support for custom code, a careful process like this is the fastest way to find the culprit.
A note on privacy and consent
Webflow's Head code section runs your script for every visitor on every page once the site is published. If you serve visitors in places with consent rules for analytics cookies, decide how consent is handled before adding analytics tags, and follow the instructions of whatever consent solution you choose for how scripts should be added.
What a head tag can do on Webflow, and what it can't
Once the snippet loads on every page, a page-level tool sees what visitors do on those pages. With marketingLABO on a Webflow site, that means:
- Analytics and heatmaps. Reports by traffic source, page and conversion, plus per-page heatmaps of time on page, scroll depth and clicks. Long landing pages built in Webflow are a natural fit for scroll maps. See our guide to website heatmaps for how to read them.
- Visitor history. A per-visitor timeline of the pages they viewed.
- Micro-conversions. Count goals by number of pages viewed, a specific URL, time on page or return visits.
- Pop-up banners. Show a banner immediately, after a delay, at a scroll depth or on exit intent, targeted by page URL, visit count, days since last visit, pages viewed or not viewed, and traffic source, in modal, floating or bar style.
And what it doesn't do: marketingLABO isn't a Webflow app and doesn't connect to Webflow's CMS, Ecommerce or form submissions, so it doesn't read your collections, cart contents or orders. If you sell on Webflow, keep using Webflow's own reports for orders and revenue, and use page-level data for what happens before checkout.
For campaign traffic, our UTM parameters guide explains how to tag links and match landing messages to them, and targeting returning visitors covers showing different messages on a first and a repeat visit.
Common mistakes
| Mistake | What happens | Fix |
|---|---|---|
| Saving the code but not publishing | Visitors never get the script. | Publish after every custom code change. |
| Judging the install from the Designer | Custom code doesn't run in expand canvas view, so it looks broken. | Test the published site. |
| Using a Code Embed element for a site-wide tag | The tag is only on the page where the element sits. | Use Site settings > Custom code. |
| Adding the tag in Page settings on a few pages | Other pages and new pages aren't tracked. | Use Head code in Site settings. |
| Pasting a second copy in Footer code | Double page views. | One copy per tool. |
| Not keeping a copy of your snippets | After a downgrade you can't view or edit the code. | Store every snippet in your team's notes. |
Quick checklist
- Paid Workspace (Core, Growth, Agency or Freelancer) or an active Site plan on this site.
- Your role can edit custom code.
- Snippet copied directly from your tool.
- Pasted once into Site settings > Custom code > Head code, with a comment above it.
- Save changes clicked, then the site published to the domain visitors use.
- Verified in a private window on several pages, plus your tool's own tracking check.
- A copy of the snippet kept in your team's notes.
FAQ
Can I add custom code on a free Webflow plan? Webflow lists custom code for Core, Growth, Agency or Freelancer Workspaces, or for sites with an active Site plan. If neither applies to your site, the custom code fields aren't available for editing.
Do I need to add the tag to every page? No. Head code in Site settings applies to your entire site, including CMS item pages, so one copy is enough.
Will Webflow support help if the script doesn't work? Webflow says its support team can't provide direct help with custom code setup or troubleshooting. Contact your tool's provider, or ask in the Webflow Forum.
I also run a Wix, Squarespace, Shopify or WooCommerce site. Is it similar? The goal is the same (the tag in the head of every page), but the steps differ. See adding custom code to the head of a Wix site, Squarespace code injection, adding a tracking script to Shopify and adding a script to the head of a WooCommerce store.
marketingLABO's Free plan includes one site with analytics, heatmaps and visitor history, plus one form and one pop-up banner, with no time limit and no credit card required. Compare plans in the pricing section, or sign up free to get your tag.
Sources
All checked on October 12, 2026.
Start free — no credit card needed
Sign up freeMore articles

How to Add a Tracking Tag to a Plain HTML Website (Every Page, Step by Step)
Add a tracking script to the head of every page on a hand-coded HTML site: where it goes, shared includes and templates, and how to verify it in DevTools.
Read the article →
Form UX Best Practices: Validation, Progress Bars and Autofill
Form UX best practices from web.dev and W3C: when to validate, how to word errors, progress for long forms, and autocomplete values that make autofill work.
Read the article →
How to Read a Single Visitor's Journey Through Your Site
Use a per-visitor timeline to spot loops, hesitation and return visits, tell anonymous from known contacts, and avoid reading too much into one journey.
Read the article →
How to Target Returning Visitors with Different Messages Than First-Timers
Show first-time and returning visitors different messages using visit frequency and days since the last visit, with recipes and the limits of tracking.
Read the article →
UTM Parameters Explained (and How to Match Landing Messages to Your Ads)
What each UTM parameter means, a naming convention that keeps reports clean, common tagging mistakes, and how to show visitors a message that matches the ad.
Read the article →
Micro-Conversions: The Small Signals That Predict a Sale
What micro-conversions are, four practical ones to track (pages viewed, key URLs, time on site, return visits), how to set thresholds and how to act on them.
Read the article →