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:
- Click Components in the Navigation panel
- Click the Pages tab
- Click New page
- Enter a name for the page (e.g., Homepage)
- 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
- Choose Yes, just this one page for a simple URL or No, it will run across multiple URLs for a complex URL
- Define your URL matching criteria if you selected No, it will run across multiple URLs
- 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:
- Click Components in the Navigation panel
- Click the Pages tab
- Select the page from your list
- Click Edit page
- Make your changes
- 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)
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:
- Set a global
windowvariable on the page — learn how to set a global window variable - Add a unique
<meta>tag to the page — learn about <meta> tags
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:
- Add
window.searchResultsPage = trueto just your search result pages - In your page definition’s Page code, check for that variable