ABalytics.js: Client-side A/B Testing With Google Analytics
danmaz74.me
danmaz74.me
So, your core coding style will only work with very particular GA implementations; anything that deviates from that could very easily break or be subject to race conditions.
You'll also get better results if you use events rather than custom variables; custom variable reporting isn't as flexible and can be very confusing (ie, visit start). It'll also mitigate the need to use concat() to cut the line, since Events can be fired at any time (whereas custom variables need to happen before the first hit of the session to be well-reported).
I also really like the idea, though. I actually pass all my Optimizely test results as Google Analytics events with this snippet:
if (window.optimmizely && optimizely.variationNamesMap) {
var optmap = optimizely.variationNamesMap;
for (var expt in optmap) {
if (optmap.hasOwnProperty(expt)) {
_gaq.push(["_trackEvent", "Optimizely", optimizely.allExperiments[expt].name, optmap[expt], 0, true]);
}
}
}There are LOTS of different versions of the GA snippet floating around the internet; the assumptions this configuration makes would only work for some of them.
For example, some people load GA like this:
<script async src="//google-analytics.com/ga.js"> </script>
<script>
var _gaq = _gaq || [];
...
</script>
Folks who do this will break at minimum with older browsers that don't support async; not sure what it would do with async support, though.It seems unnecessarily risky.
[EDIT]: . . . But I like the idea. Might even use it next time I'm working with GA.
My second thought was, "Testing is so much better than not testing, this is still worthwhile."
Seriously, if you aren't testing, do it. If you are, this is something to graduate out of.
After enabling the bookmarklet, you click the numbers you need and then it sends it to an A/B testing calculator hosted by the folks who made ABBA
Project: https://github.com/yahelc/ABBA-bookmarklet Sends to here: http://www.thumbtack.com/labs/abba/
Thanks for going MIT.
I didn't think about the code example in the post... maybe I'll add it and resubmit the post ;)
Also, you can A/B test dynamically loading content so I think you just need to find out how to do it using your chosen software.
* If the flicker isn't noticeable, it doesn't matter either way
* If the flicker is noticeable and disturbing, having it only for one version could skew the results in favor of the non-flickering version