I do the following - ( XXXXX
represent my experiment Id ) as described here - https://developers.google.com/analytics/devguides/collection/gajs/experiments#cxjs-load
<!-- Google analytics Experiment-->
<script src="//www.google-analytics.com/cx/api.js?experiment=XXXXX"></script>
<script>
var variationExperiment = cxApi.chooseVariation('XXXXX');
cxApi.setChosenVariation(variationExperiment,'XXXXX');
console.log(variationExperiment); // gives 0 or 1 according the google decision
console.log(cxApi.getChosenVariation('XXXXX')); // always returns -1 , mean cxApi.NO_CHOSEN_VARIATION
</script>
console.log(cxApi.getChosenVariation('XXXXX'))
only return -1
even though I did cxApi.setChosenVariation(variationExperiment,'XXXXX')
before .
What it is indicate ? whether my google-analytics loading didn't success ?
chooseVariation doesn't allow any parameters. It uses the experiment from script load.
https://developers.google.com/analytics/devguides/collection/gajs/experiments#cxjs-choose
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.