Optimize
4K members online now
4K 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
star_border
Reply

Optimize & Content Experiments Without Redirects from GA Experiments

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I'm currently using GA Experiments and the documentation here to manage the tests via JS within my templates: https://developers.google.com/analytics/solutions/experiments-client-side

 

"This guide uses a simple implementation example to show you how to run an experiment without redirects. This is accomplished by modifying the page in-place, using JavaScript."

 

Is this type of implementation available in Google Optimize? I couldn't find anything similar in my research, but wanted to confirm before moving on.

 

Thank you.

1 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Kevin F
April 2017

Optimize & Content Experiments Without Redirects from GA Experiments

Google Employee
# 2
Google Employee

Hi

 

Yes, with Optimize you may add a single (or multiple) javascript change on each variation where you can implement that variation by yourself.

 

You don't have to add the code in your page in advance, you can just paste your javascript using the javascript editor whenever you decide that you want to make a new experiment.

 

See https://support.google.com/360suite/optimize/answer/6369964?hl=en#script-change

 

You don't need to include the jquery script and your code will not have to run on $ready (as in the content experiments example).

 

Instead, you can select a container element (that contains the affected area of the page) and the optimize runtime will ensure that there is no flicker: your code will run as soon as this area of the page is parsed by the browser (before the user has any chance  to see the original).

 

This can be a lot earlier than $ready, which means improved performance for your experiment.

 

Furthermore you may split your code to pieces and attach them to multiple javascript changes, each on the specific element that is affected.

 

View solution in original post

Marked as Best Answer.
Solution
Accepted by topic author Kevin F
April 2017

Optimize & Content Experiments Without Redirects from GA Experiments

Google Employee
# 2
Google Employee

Hi

 

Yes, with Optimize you may add a single (or multiple) javascript change on each variation where you can implement that variation by yourself.

 

You don't have to add the code in your page in advance, you can just paste your javascript using the javascript editor whenever you decide that you want to make a new experiment.

 

See https://support.google.com/360suite/optimize/answer/6369964?hl=en#script-change

 

You don't need to include the jquery script and your code will not have to run on $ready (as in the content experiments example).

 

Instead, you can select a container element (that contains the affected area of the page) and the optimize runtime will ensure that there is no flicker: your code will run as soon as this area of the page is parsed by the browser (before the user has any chance  to see the original).

 

This can be a lot earlier than $ready, which means improved performance for your experiment.

 

Furthermore you may split your code to pieces and attach them to multiple javascript changes, each on the specific element that is affected.

 

Optimize & Content Experiments Without Redirects from GA Experiments

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Dmitris is there a way to programatically access the test buckets assigned by google optimize in my own javascript? Setting a global variable isn't always the best method for how I'm trying to run content experiments.

 

I also would ideally like to be able to detect the "control" group assignment programatically which I don't think is possible with the method you've described.

Optimize & Content Experiments Without Redirects from GA Experiments

Google Employee
# 4
Google Employee

I don't think that there is a better way yet (one could perhaps hack out info from the gaexp cookie but this is not a good idea since this is internal implementation).


Still, thank you for the feedback - I think that several other users have requested the same feature.