Rich-text Reply

javascript conflicts

SMfi 06-03-14
Accepted Solution

javascript conflicts

Hi All.

In your experience, whats the best way to deal with situation where the optimizely code conflicts wioth something else running on a site?

 

We recently had a case where we dont have the option to control on which pages the code goes (it goes on all) and a minority of pages caused a conflict.

 

 

Unfortunately those pages are important (they hold some customer info etc) and the whole test and any future test on that site arwe on hold.

 

Any and all advice would be much appreciated.

 

thanks

Sami

 

 

Level 2

Amanda 06-04-14
 

Re: javascript conflicts

Hey Sami,

Can you provide some additional detail on what specifically the conflict is? Are you seeing any error messages in the console? If you can point me to the URL where the conflict is happening this would also be helpful.

If there is a jQuery conflict and you are already loading jQuery on your site you can always change the Optimizely snippet settings to remove jQuery. Or, depending on what the conflict is, you can try re-ordering the scripts so that Optimizely runs after the conflicting script did what it needed to do.

Thanks!

Optimizely
SMfi 06-05-14
 

Re: javascript conflicts

Hi Thanks so much for the reply.

What was happening was a page where the contents were loaded using an iframe.

The Iframe contains client data from a 3rd party provider.

This was for some reason loading twice. The site tech support referred to a double cache as also possibly being related to the issue. Unfortuantely the links I have to send you would contain some sensitive ionfo so I dont want to post them here (its client data) - I could email them to you.

Is a direct email to me possible for you?


We did not see anything at optimizely end - only the site was not working properly.

 

the site is http://www.rajalacamera.fi/ it runs on magento.

 

re-ordering might work, not sure. Ideally I would like to  restrict the pages where optimizely loads and so avoid the issue all together, but unfortunately we cant do this by controlling where the code is placed, its either everywhere or nowhere.. :-(

thats why I was thinking maybe its programmatically possible. or possibly this module would give us control over it - not sure if tahts true.: http://www.magentocommerce.com/magento-connect/optimizely-1.html

 

thanks for the attention, hopefully some resolution will be possible.

 

Thanks

Sami

 

Level 2
Kathryn 06-05-14
 

Re: javascript conflicts

Hi Sami,

 

I completely appreciate the need for confidentiality - would you be able to log a support ticket by emailing a short description of the issue to support@optimizely.com, in addition to any information you feel will help, such as the experiment ID and email address for the account. Either I or one of my colleagues in support will be able to look into the issue for you further and offer a solution.

 

My hunch is that either there is a way that we can modify the variation code so that it loads conditionally (i.e. only on pages where certain elements are present or similar) or that we can modify the targeting conditions to exclude the problem pages. It may also be that there is something set up incorrectly, but I'll be able to tell you more once we've had a closer look.

 

Thank you in advance!

 

Kind regards,

Kathryn

Optimizely
SMfi 06-05-14
 

Re: javascript conflicts

Hi
thanks
I will do that - this sounds quite promising.

thanks
Sami
Level 2
Aicke 06-10-14
 

Re: javascript conflicts

@SMfi We had similar issues, here are two possible solutions, maybe someone else needs them too.

1. The content loading twice: this may happen if an element is changed with optimizely/jquery in a way that the dom is change (e.g. you move it or wrap it with a new element) the content is executed again, this happens with script tags inside such an element and maybe with iframes too.

2. If you want to exclude pages which have "special" elements on the page, you could exclude them from optimizely test via javascript: in a variation choose "Options -> Targeting -> Add more conditions... -> Satisfy this custom Javascript condition". For your project you could have written !$('iframe') to stop the experiment if there is an iframe on the page. This selector is very simple and may give false positioves if you have other iframes on the page, so you should improve it.
Everything is hard, before it is easy.
Level 2