Rich-text Reply

Experiment code executed twice in Cross-Browser Test

andreasbalzer 11-29-15

Experiment code executed twice in Cross-Browser Test

Hi,

I am experiencing an issue with Cross-Browser Test. My experiment code gets executed twice. I have not been able to reproduce this in the editor, in preview or when the experiment is live.

 

My experiment id is 4008441335.

 

The code is

var experimentBannerDiv = $("<div id=\"ExperimentEndNodePageBanner\" style=\"margin-left:10px;\"></div>");
experimentBannerDiv.insertBefore($("#AppTitleDetails"));

experimentBannerDiv.replaceWith(
  "<div id=\"ExperimentEndNodePageBanner\" style=\"margin-left:10px;\">" +
    "<h1>Should appear once</h1>" +
  "</div>"
);

 

During Cross-Browser Test, "Should appear once" gets displayed twice.

I would like to understand why this happens and what ´can be done to solve it.

 

Thanks,

Andreas

Andreas
JDahlinANF 11-30-15
 

Re: Experiment code executed twice in Cross-Browser Test

@andreasbalzer -

Most commonly, this happens when the optimizely snippet is included in the page twice.

 

I have also seen this happen when I accidentally have two versions of the same experiment running on the same page (e.g., The QA version and the Production version are both active on the page due to me messing up my URL targeting or using the force-parameter).

tedroddy 11-30-15
 

Re: Experiment code executed twice in Cross-Browser Test

Hi Andreas,

Nap0leon has some great suggestions there. The first thing I do when this is happening is make sure there is only one snippet and one version of the experiment running on the page. I've taken a look at your experiment and previewed it. I only see one snippet, and I don't see the text "should appear once" multiple times — I only see it once. It looks like you've resolved this issue but let me know if you are still having trouble!

Best,
Ted
Best,
Ted
Optimizely

Re: Experiment code executed twice in Cross-Browser Test

Hi tedroddy,
please make sure to open "Cross-Browser Test". The issue does neither appear in editor, nor preview.

Thanks,
Andreas
Andreas