Rich-text Reply

Element changes on multiple pages

hbaecklund 09-17-14
Accepted Solution

Element changes on multiple pages

How can I make the same change to an element(a menu) that appears on hundreds of pages?




Gary 09-17-14

Re: Element changes on multiple pages

Hi H!

This is a great question which is very common. Essentially, it boils down to two things:

1. The page you load into Optimizely to make the changes on serves only as a Template
2. To decide which pages your experiment runs on, this is where URL Targeting is used and this can match all hundreds of your pages using either (most commonly) a substring match or a (if you're code savvy) a regular expression.

Here's a bit more detail about all this:

Targeting an experiment to run across your entire site is a common use of Optimizely and requires a few more settings than the simple A/B tests you may have formerly run. The following are what you will want to keep in mind:

1. Targeting
1. Global CSS
1. Modifying Selectors to be broader, or adding shared classes across the entire domain

The page you load into the editor is essentially a template for you to make changes while the targeting conditions will determine where the experiment actually runs on your site. For running across a domain, or shared group or websites, you'll want to either add each URL individually (for 5 or less pages) or use a 'Substring Match' on the domain, or subdomain.

If there is no unique substring for your pages, you will need to use [custom tags to add an extra identifier to each url](

Targeting allows you to specify a variety of unique conditions for where the experiment should run. You have the ability to target specific URLs or groups of URLs depending on the match type selected. You can also target certain groups of visitors based on conditions known to be true about the visitor, such as the presence of a query parameter or browser type.

You can set targeting in Optimizely by clicking 'Options' in the top right and selecting 'Targeting' from the drop down menu.

For additional detail on the different visitor condition targeting options you have for an experiment, please reference our support article [here]( For more information and examples on the match types available for URL targeting, please reference our support article [here](

If you're making sitewide CSS changes, you will want to consider using [Optimizely's Global CSS input](

** Modifying Selectors**
If possible, tag EVERY item with a shared class (for items in common) and a unique ID across your domain and page to page. This will allow you to understand and specify what you're targeting and changing within the Variation Code.

If you are code savvy, you can take this one step further to go into the [Edit Code]( section of your experiment and modify the selectors Optimizely chooses when translating your actions in the visual editor into variation code (jQuery).
- Gary
Optimizely - Turning the World's data into action