Manually activate experiment

Sometimes might be needed that an experiment is fired manually (from Javascript) in order to make sure it runs just after certain flows are followed on the page. 

In order to do that, please follow the steps below:

  1. Create the experiment, as usual, only that in the experiment Site Area, instead of doing a match based on the URL, you'd do a match based on a JS condition.

    Inside the JS condition, the simplest condition you could use would be like below:

    (window.runExperiment ==1) 

    Doing so, the experiment will not automatically fire because that would be false by default; you'd make it true in step 2).

  2. Whenever needed to run the experiment on the page, you need to make sure that:

    • experiment condition becomes true; for the above condition you could just add code like: 

      window.runExperiment = 1;

    • trigger the experiment by adding the following code: 

      window._conv_q = window._conv_q || [];
      window._conv_q.push(["executeExperiment","{{experiment_id_here}}"]) 

      *in the bold area you'd have to place the experiment ID found inside the application as explained here: http://support.convert.com/hc/en-us/articles/204506639
Have more questions? Submit a request

Comments