feat(analytics): add A/B testing on play button using GA's Experiments

API. Revert this after the experiment
This commit is contained in:
Tyler Renelle
2015-03-20 14:44:18 -06:00
parent fa2c44a9c7
commit 009b582f25
2 changed files with 16 additions and 9 deletions

View File

@@ -26,14 +26,20 @@ function($scope, $rootScope, User, $http, Notification, ApiUrl) {
$.getScript('//checkout.stripe.com/v2/checkout.js');
// Google Analytics, only in production
if (window.env.NODE_ENV === 'production') {
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', window.env.GA_ID, {userId:User.user._id});
ga('require', 'displayfeatures');
ga('send', 'pageview');
if (true || window.env.NODE_ENV === 'production') {
// Get experiments API
$.getScript('//www.google-analytics.com/cx/api.js?experiment=OPMHlSzSTj2gVYwUS72wlQ', function(){
$rootScope.chosenVariation = cxApi.chooseVariation();
$rootScope.$apply();
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', window.env.GA_ID, {userId:User.user._id});
ga('require', 'displayfeatures');
ga('send', 'pageview');
})
}
// Scripts only for desktop