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

Analytics
4.3K members online now
4.3K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

chooseVariation method not working for an experiment

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I have done everything in the tutorial for an experiment but with a same page.

 

So what I do is :

 

<script src="https://www.google-analytics.com/cx/api.js?experiment=rq8xSjMtTnqg4e9i13S3Iw"></script>

 

and then 

var chosenVariation = cxApi.chooseVariation();
console.log(chosenVariation);

 

the variation is always 1 while I have an original page and a variant setup in the settings.