Webflow sync, pageviews & more.
NEW

How can I integrate this code into Webflow?

TL;DR
  • Use Project Settings > Custom Code for site-wide scripts in the header or footer.
  • Use Page Settings or an Embed element in the Designer to add page-specific or inline code, and always publish to activate custom code.

To integrate custom code into Webflow, you'll need to determine where and how the code should function—either site-wide or on a specific page.

1. Decide the Scope of Your Code

  • Site-wide integration is good for things like analytics, chat widgets, or global scripts.
  • Page-specific integration is best for scripts that affect only one page or a single page element.

2. Add Custom Code to the Entire Site

  • Go to Project Settings > Custom Code tab.
  • Paste your code into:
  • Header section to run code before the page loads.
  • Footer section to run code after the page content loads.
  • Click Save Changes, then Publish the site.
  • This works well for scripts like Google Analytics, cookie banners, or third-party widgets.

3. Add Custom Code to a Specific Page

  • Open the Webflow Designer.
  • Select the specific page under Pages Panel.
  • Scroll to the bottom of the page settings and you'll find the Custom Code section.
  • Paste your code into the Page Header or Footer Code field.
  • Save and Publish your site to test.

4. Embed Code in the Page Body

  • In Webflow Designer, drag an Embed element from the Add panel (press A).
  • Click the embed box and paste your code.
  • Click Save & Close, and position the element where needed.
  • Publish your site to test the embedded code.

5. Important Restrictions

  • Custom code only works on published sites, not in the Designer or preview mode.
  • Webflow sanitizes inline JavaScript and certain tags, so avoid inserting scripts directly into text or rich text elements.
  • Avoid using code that interferes with Webflow’s core layout (e.g., full document.write calls without care).

Summary

To integrate code into Webflow, use Project Settings > Custom Code for site-wide effects, page settings for individual pages, or insert an Embed element for inline functionality. Always publish your site to see the effect of your custom code.

Rate this answer

Other Webflow Questions