Optimize for non-Webflow sites

Apply global JavaScript or CSS to every page

Updated

Use global code to add site-wide functionality or styles.

You can add global JavaScript or CSS in your account settings to run site-wide — even on pages without active optimizations. This is helpful for defining reusable functions, running universal logic, or applying consistent styles across your site.

About global JavaScript

Global JavaScript runs on every page where the snippet runs. It executes:

  • Before the DOM is ready — don’t rely on DOM elements being available
  • Before any variation code or other Optimize logic
  • Even on pages that aren’t being optimized
  • For both the optimization group and the holdout group (i.e., all visitors)

Note

If you need to use jQuery, you can request to enable jQuery as a plugin.

About global CSS

Global CSS is injected into the <head> of each page as an inline stylesheet. It applies:

  • Before the DOM is ready
  • Before any Optimize-specific code
  • On every page with the snippet — even those without active optimizations
  • To both optimized and holdout visitors

Edit your global JavaScript or CSS

Open your Optimize site in Webflow, then:

  1. Click Account settings in the Navigation panel
  2. Go to Global JavaScript Code or Global CSS
  3. Click Edit
  4. Enter or modify your code
  5. Click Save