We’re transitioning to a new UI, and are in the process of updating our Webflow University courses and videos.

Page-level code

Run custom code on a single page.

Page-level code

Run custom code on a single page.

Page-level code

Page-level custom code is used when you need custom behavior to run on one specific page and nowhere else. It runs whenever that page loads, for every visitor, but does not affect other pages on the site. It’s the right choice when code shouldn’t be tied to a specific layout position and also shouldn’t apply site-wide.

A code snippet shown inside the Before </body> tag field within Webflow Page settings.

Page-level custom code works best when:

  • The behavior is limited to a single page
  • The code doesn’t need to appear inside the layout
  • Running it elsewhere would add confusion or unnecessary load
  • You want to keep the impact small and contained

Common examples include:

  • Adding a marketing or analytics script to a single landing page
  • Loading a chat widget only on a contact or support page
  • Running a small script that targets elements unique to one page
  • Adding an A/B testing or experiment script for a campaign page

In many cases, this code is copied from third-party tools and added as a snippet, rather than written from scratch.

How to add page-level custom code

To add page-level custom code in Webflow:

  1. Copy the code snippet from the tool or service, such as an analytics platform, chat provider, or testing tool.
  2. Open the page settings for the page where the code should run.
  3. Paste the code snippet into either the <head> or </body> section, depending on the tool’s instructions.
  4. Save and publish the page to staging or production to confirm the code runs as expected.

Placement of page-level code: <head> vs <body>

Page-level custom code can be added in two places:

  • <head> — loads earlier and is typically used for tracking, verification, or scripts that need to run as the page starts loading
  • </body> — loads later and is better for scripts that rely on page content or existing elements
Third-party tools usually specify where their code should go. When they do, it’s best to follow those instructions.

Common mistakes to avoid

Page-level custom code is flexible, but a few patterns can cause issues:

  • Duplicating the same script across multiple pages, which makes updates harder
  • Forgetting page-level code exists, especially on older or less-visited pages
  • Using page-level code when the behavior should be site-wide, leading to inconsistent experiences

If you find yourself copying the same snippet onto many pages, that’s often a sign that site-level custom code is a better fit.

Feeling good?

Now that we’ve covered page-level code, let’s take a closer look at custom code at the site level.

No items found.

1

Getting started

Getting started
Getting started
Coming soon

1

Background & preview
5:00
Background & preview
Coming soon

1

Where you can add custom code
5:00
Where you can add custom code
Coming soon

2

Adding custom code

Adding custom code
Adding custom code
Coming soon

2

The code embed element
5:59
The code embed element
Coming soon

2

At the layout level (Code Embed element)
4:00
At the layout level (Code Embed element)
Coming soon

2

Page & site level code
Page & site level code
Coming soon

2

Page-level code
5:00
Page-level code
Coming soon

2

Site-level code
5:00
Site-level code
Coming soon

2

Custom code and the Webflow CMS
5:00
Custom code and the Webflow CMS
Coming soon

3

Managing custom code

Managing custom code
Managing custom code
Coming soon

3

Previewing, testing, & troubleshooting
5:00
Previewing, testing, & troubleshooting
Coming soon

3

Best practices for maintainable code
5:00
Best practices for maintainable code
Coming soon

4

Wrap up

Wrap up
Wrap up
Coming soon

4

Try it: Add custom code
3:00
Try it: Add custom code
Coming soon

4

Wrap up

Try it: add page level code
3:00
Try it: add page level code
Coming soon

4

Wrap up

Try it: add site-level code
3:00
Try it: add site-level code
Coming soon

4

Additional resources
4:00
Additional resources
Coming soon

Course progress

0%

Assessment

Up next

Site-level code

Run custom code across your entire site.
Complete & continue
Complete course