Alternative to pages for URL targeting in Optimizely Experimentation

  • Updated

This topic describes how to set up URL targeting for your Optimizely Experimentation experiments without using pages.

URL targeting specifies the pages where an experiment or campaign should run. In Optimizely Experimentation, you can use reusable pages to set up URL targeting. Pages are great for reusing targeting conditions across multiple experiments, but they require some time and strategic thinking to set them up.

Optimizely Experimentation is introducing an alternative to pages for targeting experiments. This alternative targeting option only requires a URL. This method of URL targeting helps you get started with Optimizely Experimentation, and it is a quick option when you do not need a reusable URL targeting solution.

Targeting menu and options

To find the targeting menu for an experiment:

  1. Go to Experiments and select the experiment you want to target.

  2. Click Targeting.

The targeting menu (formerly called “Pages”) is where you can edit URL targeting settings for an experiment: Editor URL, pattern matching, exclude URLs, test URLs, and activation modes. You can click Save as Page to save your URL targeting settings as a page for future reuse.

You also have the option to target by saved pages. If you want to create a one-time instance of a page for an experiment, click the Actions dropdown list and select Use Page as URL Target.


Event tracking with URL targeting

You can select pre-defined events in the metrics builder or create new click events for your URL targeting experiment.

If you do not want to use an event in more than one experiment, you can create a single-purpose click event by enabling click tracking on elements from the Visual Editor.


Optimizely Experimentation creates a pageview event for the URL you used for URL targeting. The name is listed as “Visit Page: URL Targeting for [experiment name]” and you can find the associated event ID in the API Names menu.

URL targeting with custom snippets

If you are using custom snippets, you can still use URL targeting for your experiments. One thing to remember is to make sure that the URL you want to target your experiment to is included in the custom snippet definition. Simply defining a custom snippet by pages will not include experiments targeted using URL targeting. We recommend adding a URL pattern in your custom snippet definition to include experiments that use URL targeting:


Debugging URL targeting

Targeting by URL creates a page in the Optimizely Experimentation data model, so debugging an experiment using URL targeting is very similar to debugging an experiment with saved pages.


The URL targeting condition is listed as a page in the API Names menu. The name of the “page” is “URL Targeting for [experiment name]” and the associated ID is listed. These values are based on the information our JavaScript API returns, and you can use it when debugging an experiment using URL targeting.