CTA doesnt trigger js in preview
Im trying to set up a variation for A/B testing and the variation has 2 call to action buttons that should trigger a lightbox each. In preview mode, it doesnt trigger the lightbox, and im not sure if this is a Optimizely setting or not? If i test the CTA independantly outside of Optimizely by manually editing the DOM to show the CTA, it works.
Is this something that i need to worry about? Is Optimizely suppressing the js from firing?
Have you tried forcing the test to run on the site itself? To do this, add the following parameter to the URL of the page:
?optimizely_x[EXPERIMENT ID]=[VARIATION INDEX]
Where [EXPERIMENT ID] is the ID of the Experiment (this can be found in the URL of the editor window of your Experiment under the parameter “experiment_id”) and [VARIATION INDEX] with the index of you variation (0=Control, 1=Variation #1, etc.).
If the page comes up with an overlay saying that you can't do this, simply go Settings->Privacy within the Optimizely dashboard, and make sure that “Disable the force variation parameter” is unchecked.
I hope that helps.
Ok, i spoke too soon. The overlay is now gone and i am able to do a test as you suggested,
However, as i suspected, my CTA js executions are being suppressed.
OK, my next suggestion would be to post the details of the Optimizely log on the page. To get this up add this parameter to the page:
and open up the console of the page (Windows: Ctrl + Shift + J, Mac: Cmd + Opt +J). Paste the contents of the console on here.
Here's more info on the Optimizely log: The console, data object, and Optimizely log
Is there something specific i should look for? It says my experiment is failing, but that is because it is paused. It doesnt mention anything about why the js isnt being triggered.
I also turned on the Experiment briefly to test, and even after it was on, the js doesnt execute on the ctas.
If you force the test as well as adding the parameter to the URL it should explain any issues with your code:
?optimizely_x[EXPERIMENT ID]=[VARIATION INDEX]&optimizely_log=true