It seems most of the A/B and multivariate experiments ask you to create entirely new pages, which is not possible for 10,000 products. I only want to try different add to cart buttons, so wouldn't it make sense that I just add a script around the code which generates the button.

  • 1
    Yes it would make sense if that is the only thing that you are going to change.
    – Kenny
    Jan 28, 2013 at 9:28

5 Answers 5


Just an idea:

add the variant to the session in a early event, change the AddToCart-Block and add the variant to the cache-key, change the template in an observer on basis of the variant.


In the context of Magento there are usually two different parts to A/B testing:

1) HTML+CSS Manipulation

This is where we would change things like the size of some text, or what image to place behind a button.

One product you might consider is Visual Website Optimizer.

In addition to being popular with some big names (such as amd, microsoft etc.), they claim to have some basic support for Magento.

2) Manipulating the actual template files

Here we would change things like the layout (order and position of blocks), or present the user with a different look.

One way to accomplish this, is to create two "views" (under one website), and use different URL's for each view, such as: www.site.com www1.site.com.

Once this is set up have Google's A/B testing functionality (or some other JS) direct users to the different views.

Good luck!

  • +1 for VWO, it's easy enough to set up, the only downside - depending on where you live - it can seem to slow down the site a little bit Jan 28, 2013 at 23:38
  • 1
    There's an A/B testing plugin for Magento: magento-optimizer.com
    – tonyhb
    Sep 5, 2013 at 6:12

I would tackle this issue purely by adding an additional class to the Add to cart button, styling it appropriately. Performance tracking can be added in the same section of the code if tracked via JavaScript (google analytics).

var abSwitch = ((Math.floor(Math.random() * (1000 - 2)) + 1) % 2 == 1) ? 'abtesta' : 'abtestb';
if($$('.add-to-cart .btn-cart') != null){
    $$('.add-to-cart .btn-cart').each(function(el){

http://www.optimizely.com/ doesn't ask you to create entirely new pages. They have a small JS hook you include and then you have the option of writing Javascript or using their GUI for the A/B cases. URLs can be pattern matched.


There's a plugin I've used called Magento Optimizer for a client before which gives good results for server-side A/B testing. It's integrated into the Magento admin panel and changes your HTML before a user downloads it.

You create multiple template files and write an XML layout update for each variation pointing to the new file and your A/B test is set up.

If you want to test more than just a few buttons (think layout updates, functionality, themes etc. - you can test anything) you should check out this tool, or look into the hook system to roll your own.

(full disclaimer: I developed this back at work for a client, it worked really well)

Your other options are either JS based products (Optimizely, VWO, GWO) which can be a bit slow and change the page in front of a user, plus don't have built-in ecommerce tracking.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.