Optimize for non-Webflow sites

Create or edit a page definition

Updated

Define the webpages where your optimization runs and where goal events take place.

Page definitions tell Optimize which webpages to run your variations on — and where to track your goal events. You can define a page using a single URL, a set of URL-matching rules, or advanced code checks when URL matching alone isn’t enough.

Before you get started

Make sure the Optimize snippet is installed on every page you define and the page's domain is on the allowed list.

Page definition options

When you create a page definition, you have a few paths you can take:

  • Top pages — select from a list of high-traffic pages that don’t already have a definition (only shows if any exist)
  • Simple URL — enter or paste the URL of a specific webpage
  • Complex URL — use advanced rules (e.g., regex) to define a pattern or group of pages

How to add a page definition

Open your Optimize site in Webflow, then:

  1. Click Components in the Navigation panel
  2. Click the Pages tab
  3. Click New page
  4. Enter a name for the page (e.g., Homepage)
  5. Enter a URL for the webpage (e.g., https://www.mywebsite.com/solutions)
    • For a simple URL — enter or paste the URL for the webpage from your browser's address bar
    • For a complex URL — enter a URL here that the visual editor can access to preview the webpage
  6. Choose Yes, just this one page for a simple URL or No, it will run across multiple URLs for a complex URL
  7. Define your URL matching criteria if you selected No, it will run across multiple URLs
  8. Click Save when you're done

How to edit a page definition

Important

Changes to a page definition may impact any linked optimizations or events — review them before editing.

Open your Optimize site in Webflow, then:

  1. Click Components in the Navigation panel
  2. Click the Pages tab
  3. Select the page from your list
  4. Click Edit page
  5. Make your changes
  6. Click Save

Complex URL matching guide

Choosing No, it will run across multiple URLs expands the form to include additional options:

  • URL matches — select how you want to define the URL from one of four URL matching options
  • Add Criteria — include more matching criteria so that other pages can also match your page definition
  • Test if URLs match your criteria — enter site page URLs to verify if they do or do not match your defined criteria
  • Advanced — optionally enter JavaScript in the page code field to help define the page 

URL matching options

URL has this path (common):

This is the most common and often recommended matching option. Enter a clean, readable URL and Optimize will match any variation of it, including versions with query parameters, hashes, trailing slashes, and www or http differences.

For example, https://www.mywebsite.com/solutions will match:

  • https://mywebsite.com/solutions
  • https://www.mywebsite.com/solutions/
  • https://www.mywebsite.com/solutions?utm_source=google
  • http://www.mywebsite.com/solutions#contact

URL must be identical to:

Enter a URL and Optimize will only match the page if the URL exactly matches what you enter — including protocol, slashes, capitalization, and query parameters.

For example, https://www.mywebsite.com/products/dog-bone?id=98765

URL contains these characters:

Enter part of the URL and Optimize will match any page where its URL includes the exact string you entered anywhere in its path. Useful for subdirectories or specific parameters.

For example, /products/phones/ would match:

  • https://www.mywebsite.com/products/phones/brand/
  • https://mywebsite.com/products/phones/brand/page1#details

Advanced pattern matching (regex):

Use regex (regular expression) to match multiple URLs or complex structures with full pattern control. Enter part of the URL along with variables to define or exclude specific criteria. You can use the following template to guide your expression:

^(https?:\/\/)?(www\.)?example\.com\/?($|[?#].*?$)

For example, you want to match only the following three subdirectories: /dogs/toys/, /dogs/beds/, /dogs/food/

^(https?:\/\/)?(www\.)?mywebsite\.com\/dogs\/(toys|beds|food)

Pro tip

If you're not familiar with regular expressions, try tools like regex101 or W3Schools to test your expressions.

Page code JavaScript

If URL matching isn’t precise enough, you can add JavaScript to confirm a match. This is useful when:

  • Multiple page types share the same URL pattern
  • Pages vary in layout or structure

The code must return true for the page to be considered a match.

Recommended methods:

Note

Make sure the variable or tag is loaded before the Optimize snippet runs.

For example, targeting search results but not browse pages with the same URL structure:

  1. Add window.searchResultsPage = true to just your search result pages
  2. In your page definition’s Page code, check for that variable