Rich-text Reply

Custom Variations in Magento

darren-halo 06-07-16
Accepted Solution

Custom Variations in Magento



I'm just learning about Optimizely and installed on a blank Magento Site to test. I have a couple of basic questions after setting up my first Experiment.


1. How do we create an experiment for all product page URL's?

so really I want to create a change to the product page template, not just a specific product page URL. Is this just done by using a 'Simple match' URL rather than exact match? or is this more complicated than that?


2. More customisations than the editor allows.

What is the best way to make more edits than the visual editor allows? For instance I'd like to remove an image carousel on one variation and change it for a different type of image carousel on another.

If I create the variations as Magento themes, can Optomizely use Magento themes as the variations?


3. I dont really understand the goals Would a typical example be variations on a product page and the goal being a user completing a sale from that page?


4. Attribute tracking. Please can someone explain, im obviously being dense.. If I have some variations of a page and a user converts after using one of them..  how do the results differ for the base attributes Sku, Name, price.. i mean they dont change so how would tracking them show anything other than the same name or price regardless of variation.


Many Thanks!


beckyhall 06-07-16

Re: Custom Variations in Magento

Hi Darren, welcome to Optimizely!

1. In this situation you wouldn’t want to use simple match. Simple match is really only used for tests that need to run on ONE page, ex: your homepage or your cart page. The easiest way to select all pages of a given type is if the URLs have some similarity where you can match them all with substring match or a regex match (ex:, could be substring matched to ‘’), but when that is not an option, you have to be a little more creative.

Audience conditions are more flexible than URL targeting and allow for custom JavaScript conditions or custom tags to target your experiment (Optimizely recommends using a Custom Tags audience in this situation: Another solution is to use Conditional Activation and look for the body class indicating you’re on a product page (

However, all of these options are only available for enterprise plans. You can do a work around where your URL targeting targets the entire site (ex: substring match ‘’) and you target your variation JavaScript to only product pages (again, check for the body class before making any of your changes). This option is not ideal since the EXPERIMENT would still be targeted to the entire website and therefore including “visitors” in your results who may have never been to a product page.

2. For more advanced customizations, you are going to need to use custom JavaScript and CSS:

3. Simply put, goals are the reason you’re testing. What is the hypothesis of your test? Are you hoping to push email sign ups with your new variation? Add to Cart clicks? Total revenue? Whatever you track in the goals of an experiment will provide the basis for knowing which variation is the winner and which should be implemented to all your users.

4. I’m not sure what you’re referencing by “attribute tracking”. Can you please provide more context?
darren-halo 06-07-16

Re: Custom Variations in Magento

Thanks soo much for taking the time to explain - really appreciated Smiley Happy


by 'attribute tracking'.. im referring to this paragraph:

By default, this plugin creates a JavaScript object on the page which contains price, product type, name and SKU. It's also possible to add additional properties to this object. We can then set up custom JavaScript conditions to track product types, products within a certain price range or whatever you wish.



Just broadly speaking, when it says it creates an object which contains the price, product name, etc.. why does it do this? I dont understand how the price, name, etc are used?






beckyhall 06-07-16

Re: Custom Variations in Magento

Ok cool, I didn't realize you were using the Magento plugin. The main use for the JavaScript object created with that plugin is to enable more advanced targeting. As I discussed in the answer to your first question, targeting tests to pages that do not share a URL pattern requires either specialized audience conditions or conditional activation. This plugin makes creating a custom audience easier, and actually if I remember correctly, has been updated to use the Custom Tags that I mentioned previously.

fweb 08-11-16

Re: Custom Variations in Magento

[ Edited ]

Hi Becky -

For #1 would Darren be able to use the manual activation method? And he can fire off that code when needed by hard-coding into the product template?

Obviously the experiments would have to be organized strategically...

I'm going back-and-forth on the same issue. I have a variation that's conditional based on code within the product template (Magento as well, but not with optimizely plugin). When that condition fires, I've added the manual activation for optimizely in there alongside it.

What do you think?


Level 1