I'm using the Javascript API for Google Analytics Content Experiments and it seems like you have two choices:
chooseVariation()
, orsetChosenVariation()
(1) lets Google control the number of users assigned to each variation, which I need, but I have several experiments. This seems pretty basic. What am I missing?
Ad variations make it easy for you to test multiple versions of your ads by changing up the headline or description text, testing out different promotions, or highlighting the benefits of your products and services in various ways. Ad variations can also be applied to the final URL as well as the mobile URL.
Ad variations are best used when you want to test one change across multiple campaigns or your entire account, while custom experiments are best to test multiple simultaneous changes on a smaller scale.
I don't think you're missing anything. My understanding is that the GA Experiments API allows you to allocate a visitor to any version of a single A/B/N test with the Choose Variation command :
cxApi.chooseVariation();
However, this function is only available if you specify the experiment ID when loading the api.js on the page.
If what you want to do is to run several A/B tests on one page at the same time, this is really multi-variate testing and unfortunately this is not available 'out-of-the-box' in GA Content Experiments (it used to be available with Google Website Optimizer). You can still 'fake' it using your own bucketing, with code like :
<!-- 1. Load the Content Experiments JavaScript Client -->
<script src="//www.google-analytics.com/cx/api.js"></script>
<!-- 2. See if the visitor has seen an experiment already -->
<script>
// loop through all active experiments server-side.
cxApi.getChosenVariation(
$experimentId
);
<!-- 3. Bucket the visitor if he isn't bucketed already -->
// loop through your live experiments
cxApi.setChosenVariation(
$chosenVariation, // The index of the variation shown to the visitor
$experimentId // The id of the experiment the user has been exposed to
);
</script>
You will need to decide whether you want a visitor to only view one experiment at a time or enter multiple experiments concurrently.
The first option is probably more reliable but means you will have to split your visitor in quite a lot of buckets, meaning your tests will take a long time before returning a result.
If you use the second option, you need to be careful : if your experiments are not independent, you won't be able to trust the test results from Google Analytics, as the statistical tests used in the Content Experiments assume independence. Even if your experiments are independent, you'll need to have an equal split among all variation combinations.
I hope that helps !
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With