AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

1.9K members online now
1.9K members online now
Everything you need to know about setting up Optimize including creating your account and container, linking to Google Analytics and how to tag your site.
Guide Me

Is variation Javascript supported? - Google Optimize vs Optimizely

[ Edited ]
Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Right now I'm using Optimizely which allows for custom CSS or JS to be rendered in variations. Does Google Optimize support this?


If I need to animate, trigger an event, or fire an AJAX call in a variation is this possible?


Edit: I would also like to know if it's possible to pause tests as opposed to ending them. Occasionally we'll want to run an A/B/C/D test, come to a determination, and pick the two leaders, then potentially run a B/D test with A and C paused.


This seems like an excellent tool for the layman or casual blogger, but I'm hoping this is a powerful enough tool to be of use for development as well, and I'm very excited to see the interface and other functionality is on par with other paid services

1 Expert replyverified_user

Is variation Javascript supported? - Google Optimize vs Optimizely

Google Employee
# 2
Google Employee



Yes you can do javascript changes but Google Optimize doesn't include or use JQuery.

If you want your use JQuery in your javascript code, you need to include it in your page above the Optimize snippet



Apart from that, you can attach one or more javascript changes on any element on the page, and your code is guaranteed to run after the starting or ending tag (an option on a Javascript change), has been parsed in the document.


As far as CSS, Google Optimize is implementing all style changes with inline CSS (not using the JQuery css method) which means that are usually a lot more robust and will not flicker.

There is a CSS code dialog in the editor where you can view and edit the CSS generated by the editor or even paste your own CSS code.


About the second question for pausing variations A and C: Google Optimize supports changing of variation weights after the experiment has started so should address what you want to do.


Just change variation weights from 25,25,25,25 to 50,0,50,0.


This change will only apply to new visitors, so the collected stats for variations B and D will still be valid.



Is variation Javascript supported? - Google Optimize vs Optimizely

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Thanks, Dimitris! That was a very helpful response.