mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
feat(analytics): add A/B testing on play button using GA's Experiments
API. Revert this after the experiment
This commit is contained in:
@@ -26,7 +26,12 @@ function($scope, $rootScope, User, $http, Notification, ApiUrl) {
|
|||||||
$.getScript('//checkout.stripe.com/v2/checkout.js');
|
$.getScript('//checkout.stripe.com/v2/checkout.js');
|
||||||
|
|
||||||
// Google Analytics, only in production
|
// Google Analytics, only in production
|
||||||
if (window.env.NODE_ENV === 'production') {
|
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(){
|
(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),
|
(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)
|
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||||
@@ -34,6 +39,7 @@ function($scope, $rootScope, User, $http, Notification, ApiUrl) {
|
|||||||
ga('create', window.env.GA_ID, {userId:User.user._id});
|
ga('create', window.env.GA_ID, {userId:User.user._id});
|
||||||
ga('require', 'displayfeatures');
|
ga('require', 'displayfeatures');
|
||||||
ga('send', 'pageview');
|
ga('send', 'pageview');
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scripts only for desktop
|
// Scripts only for desktop
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ block content
|
|||||||
//while acting similarly to a logo
|
//while acting similarly to a logo
|
||||||
h1#tagline=env.t('tagline')
|
h1#tagline=env.t('tagline')
|
||||||
p.lead
|
p.lead
|
||||||
button.btn.btn-primary.btn-lg#frontpage-play-button(ng-click='playButtonClick()')=env.t('playButton')
|
button.btn.btn-primary.btn-lg#frontpage-play-button(ng-click='playButtonClick()', ng-class="{'btn-success':chosenVariation==2}")
|
||||||
|
| {{chosenVariation==1 ? "Play for Free" : "#{env.t('playButton')}"}}
|
||||||
hr
|
hr
|
||||||
img(src='/marketing/devices.png')
|
img(src='/marketing/devices.png')
|
||||||
//we'd want the tagline centered, for sure, and a bit more pop, but without using jumbotron
|
//we'd want the tagline centered, for sure, and a bit more pop, but without using jumbotron
|
||||||
|
|||||||
Reference in New Issue
Block a user