It seems there are two questions in this
- How do I track multiple goals with Google Experiments
- How do I run multiple experiments on the same page?
For number 1, this might be a good reference but in short you can't track multiple goals which is why they give you an option to rewrite the data from variations into the original URL in content reports. You then have to sift through the data manually. In all honesty, I think the best way for you to track from different variations most relaibly is to simply make your event tracking dynamic so that it is aware of which variation you are on. So for example, if you have click-tracking set up on your buttons you could do something like
var variationNum = 1; // variation you are on
$('.element-to-track').on('click', function(e) {
ga('send', 'Variation ' + variationNum, 'Event Action', 'Event Label');
})
For number 2, how to run multiple experiments, it really requires to have multiple experiments and then using the cxapi and then grabbing the variation for each of those experiments. This answer provides a lot of insight but essentially the cxapi lets you set variation for the user for specific experiments.
cxApi.setChosenVariation(variation1, ‘YByMKfprRCStcMvK8zh1yw’);
cxApi.setChosenVariation(variation2, ‘FAsjnfJKFASywafasaFSAa’);
Set the user will be put into those two experiments independently of each other. Unfortunately the determination of variation, which you usually use cxapi.chooseVariation()
requires you to do load the api with the specific experiment ID in mind.
One thing I did notice is that you technically can make the request twice and passing the separate parameter will make it so that it does have the chooseVariation()
but not sure if this is the cleanest solution.
<script src="//www.google-analytics.com/cx/api.js?experiment=YByMKfprRCStcMvK8zh1yw"></script>
<script>
var variation1 = cxApi.chooseVariation();
</script>
<script src="//www.google-analytics.com/cx/api.js?experiment=FAsjnfJKFASywafasaFSAa"></script>
<script>
console.log('Experiment FAsjnfJKFASywafasaFSAa');
var variation2 = cxApi.chooseVariation();
console.log(variation2);
</script>
<script>
cxApi.setChosenVariation(variation1, 'YByMKfprRCStcMvK8zh1yw');
cxApi.setChosenVariation(variation2, 'FAsjnfJKFASywafasaFSAa');
</script>
Hope this helps.