feat(analytics): call service from app

This commit is contained in:
Sabe Jones
2015-06-22 16:35:17 -05:00
parent 83e0eb374f
commit 2ce1daffb8
12 changed files with 51 additions and 75 deletions

View File

@@ -5,8 +5,8 @@
*/
angular.module('habitrpg').factory('Guide',
['$rootScope', 'User', '$timeout', '$state',
function($rootScope, User, $timeout, $state) {
['$rootScope', 'User', '$timeout', '$state', 'Analytics',
function($rootScope, User, $timeout, $state, Analytics) {
var chapters = {
intro: [
@@ -184,14 +184,13 @@ function($rootScope, User, $timeout, $state) {
$state.go(step.state);
return $timeout(function(){});
}
window.ga && ga('send', 'event', 'behavior', 'tour', k, i+1);
mixpanel.track('Tutorial',{'tour':k+'-web','step':i+1,'complete':false});
Analytics.track({'hitType':'event','eventCategory':'behavior','eventAction':'tutorial','eventLabel':k+'-web','eventValue':i+1,'complete':false})
}
step.onHide = function(){
if (step.final) { // -2 indicates complete
var ups={};ups['flags.tour.'+k] = -2;
User.set(ups);
mixpanel.track('Tutorial',{'tour':k+'-web','step':i+1,'complete':true});
Analytics.track({'hitType':'event','eventCategory':'behavior','eventAction':'tutorial','eventLabel':k+'-web','eventValue':i+1,'complete':true})
}
}
})