- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Preview working but live experiment does not

Preview working but live experiment does not
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report
Hello,
I'm currently performing A/B testing on a dynamically loaded web-page. I rearranged a couple of elements on the web-page, and am able to preview the variation correctly. However, then I start the experiement, users are still able to see only the original page. The variation is not loading. I do have js files in my code which are responsible for the positioning of the elements on the web-page. Clearly, there's a conflict between my js files and jQuery used by Optimizely to arrange the same elements. But I believe Optimizely already takes care of this by using noConflict(). Is there anything I can do to get my users to see the variation? Any help will be appreciated.
Thanks!
Solved! Go to Solution.

Re: Preview working but live experiment does not
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report
If this is the case, then you should find the selector for the element you want to test, and add the following code into the <Edit Code> box in Optimizely:
window.myInterval = setInterval(function() {
if ($("#selector").length > 0) {
$("#selector").dosomething();
clearInterval(window.myInterval);
}
}, 50);
Just change #selector to the selector of the element you want to edit, then replace $("#selector").dosomething(); with the variation code that you were already using to change the element in Optimizely.
Essentially, what this code does is:
(1) Checks for the presence of your element on the site
(2) If it finds it, then executes the changes
(3) Checks again every 50 milliseconds if it's not found
Please let me know if that works for you, Gaurav! And for other readers out there, if you're having a similar problem where elements load dynamically and won't appear in your variation, you can use this same code.
Re: Preview working but live experiment does not
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report
Thanks Adam! It worked alright. My biggest concern was how Optimizely takes care of handling changes to elements which are getting changed in some JS code. Now it all makes sense.
Thanks again for your help.