Rich-text Reply

Target page element instead of page URL

jasperdew 02-15-16

Target page element instead of page URL


For the website I would like to test on we use two different product page templates. In order to test on all pages of one type of product page, I like to target only that template. However, there is no way to use the URL targetting functionality to distinguish one template from the other one.

I'm afraid that if I don't specify the template type I get a lot of noise in the experiment since it's poluted by also tracking the other pages in which we don't make the change.

Any idea how to set this up?

DavidS 02-16-16

Re: Target page element instead of page URL

Hello jasperdew,

Thanks for reaching out!

There are multiple ways to go about doing what you are trying to achieve, depending on the plan you are currently on with Optimizely. 


In case you are a Starter customer:


To only target pages with a specific design, you can use Manual Activation to trigger Optimizely only when visitors to your website see the design you want your experiment to run on. Manual Activation allows you to activate an experiment only when a specific Javascript call is sent to Optimizely. This Javascript call should have the following format : 

window.optimizely.push(["activate", EXPERIMENT_ID]);

EXPERIMENT_ID being the ID of the experiment you want to run.

In this case, you'd add this call only on the pages you'd want the Optimizely experiment to run on. You can find out more about the Manual Activation via this Knowledge Base article


In case you are an Enterprise customer: 


You can use a feature called custom tags. Here is a step by step process on how to use custom tags :

1. You'd create a new audience, targeting visitors with a specific custom tag. In your case, you could set the custom tag name to new_design and its value to true. I attached a screenshot to show you exactly how to set that up. 

2. You'd add this code before the Optimizely snippet on pages where your visitors would see the new design:

window['optimizely'] = window['optimizely'] || [];
window['optimizely'].push(["customTag", "new_design", "true"]);</script>

Custom Tags allow you to target your visitors based on unique information about them. 

You can find out more about Custom Tags in this article.


Does that help? Let me know if you are having issues implementing this logic!


Custom Tag How To.png