Rich-text Reply

Firing a test in an ajax cart

testtriggers 07-23-15

Firing a test in an ajax cart

I'd like to run a test where I remove the "disccount code" box from the shopping cart. On our site, this "discount code" box exists in two places; 1. The shopping cart page (e.g. and 2. The "slide out" ajax cart that appears when a user clicks "Cart" from any page.


Here's what I have tried (following along with these instructions):


- I created two experiments 

- Experiment #1 has 100% of traffic allocated to it and has this code (#fc-sidecart is the div for the slide out cart, and 3222270180 is the experiment ID for Experiment #2: 

  1. //Click Event: 
    $('#fc-sidecart').bind('click', function() { 
     window.optimizely.push(["activate", 3222270180]); 

Experiment #2 is set to 50/50 allocation and in the edit code box I have (this code simply removes the discount code box):

$(".fc-transaction__discounts").css({"display":"none", "visibility":""});

I just can't seem to get this to work. Is there anything else I can provide to help troubleshoot this?

Josh Frank
Founder & Head of Optimization
Test Triggers - Optimizely Solutions Provider

Optimizely Platform Certified


Re: Firing a test in an ajax cart

Hi @testtriggers,


It sounds like you're on the right path.  You'd want to ensure the following order of operations:

  1. Experiment 1 has 100% of traffic allocated to one variation
  2. Experiment 1's variation code contains the click binding function, with the manual activation API call
  3. Experiment 1 uses immediate activation and is live
  4. Experiment 2 has two (or more) variations, each with equal traffic allocation
  5. Experiment 2 has variation code per variation that makes the changes you want
  6. Experiment 2 uses manual activation and is live

When I took a look at your project and experiment, I didn't see an experiment that satisfied steps #1-3.  Could you provide that experiment ID?


I also see that experiment ID 3222270180 is paused.  Once you set up experiment #1, can you push this one live too?

Harrison Krat
Solutions Architect | Optimizely, Inc.