I am new to Google Optimize A/B and multivariant test tools.
I am creating one experiment and noticed that I can/modify the look of the url I specify there. For example 50% of the traffic looks at variant a, the rest to b.
In my experiment I don't want to modify the page look, but instead I want to set for variant a a particular variable for example "groupA" and have my javascript code call a different API based on the group we belong.
Afterward the experiment result will monitor the conversion rate which is (nrPeopleClickingAButton / nrPeopleLandingOnThisPage).
Is there any way to achieve this?
How can I fetch the group name or experiement id or experiement name via Javascript in my code and let both variant a and b have exactly same look ?
I read one relevant article https://support.google.com/optimize/answer/9059383?hl=en#zippy=%2Cin-this-article
but they don't explain
- How I can get the experiement id for example for variant_a
- How can I avoid the editor changes being applied to my variants. I don't want any page look change, I just want to inject different JS variable based on the group we belong then handle that myself in JS. That is all
You can get the experiment_id here:
If you are using optimize.callback, with this code:
You have to replace <experiment_id_A> with your Experiment ID (previous image), then in implementExperimentA function you have to change your page depending the variantion (0 - original, 1 - variant 1, 2 - variant 2...)
If you only want to change a variable and not to change the layout, you need to use "code editor" option and not make any more change, more info: add global js