How to add custom code to a Webflow site
Analytics tags, chat widgets and most third-party tools install on Webflow the same way: one script in the site’s head code. It takes a few minutes. The step people miss is publishing.
Before you start
- An active Site plan on the site, or a Core, Growth, Agency or Freelancer Workspace
- The script you were given, as a complete <script> tag
- Permission to publish the site
Steps
- Open the Custom code tabIn Webflow, open Site settings and choose the Custom code tab.
- Paste the script into Head codeHead code is added before the closing head tag on every page of the site. Paste the whole tag, including the opening and closing script tags. Leave out html, head and body tags; Webflow adds those.
<script defer src="https://example.com/tool.js"></script>A typical third-party tag. Use the one your tool gave you. - Save changesClick Save changes. The code is stored but visitors do not get it yet.
- Publish the siteCustom code shows in Webflow’s preview mode, and goes live only when the site is published. Publish to your domain.
Check it worked
- Open the published site in a private window, view the page source and search for the script’s address.
- In the browser’s developer tools, the Network tab should show the script loading with status 200.
What goes wrong
- The script is in settings but not on the site
- The site was saved and not published. Publish again and reload the live page.
- The script breaks the Designer preview
- Wrap it between <!-- EXCLUDE FROM PREVIEW: START --> and <!-- EXCLUDE FROM PREVIEW: END --> so it runs only on the published site.
- The field rejects the code
- Each custom code section holds 50,000 characters. Load a large script from its own URL in a script tag and keep the code out of the field.
- Pages got slower
- Webflow warns that external scripts in the head can slow a page. Add defer or async to the tag when the tool’s instructions allow it.
Checked on 2026-11-11 against Webflow Help: Custom code in head and body tags.
Increase conversions on your Webflow site by 20%
Dynamite personalizes the page for every visitor. Dynamite personalizes a Webflow site from one script line in Head code. After that you choose which headlines, proof and buttons may change, and for whom.
Dynamite for WebflowQuestions
Can I add custom code on the free Starter plan?
Webflow’s requirement is an active Site plan on the site, or a Core, Growth, Agency or Freelancer Workspace. Its article does not list Starter among them.
Does head code apply to CMS pages?
Yes. Site-wide head code is added to every page, including collection pages.
How do I remove it?
Delete the code from Head code, save, and publish again.