fix(analytics): Track intro tour steps 1-2

This commit is contained in:
Sabe Jones
2015-07-23 15:07:37 -05:00
parent bfd56b35e1
commit c8982b3513

View File

@@ -178,14 +178,14 @@ function($rootScope, User, $timeout, $state, Analytics) {
step.content = "<div><div class='" + (env.worldDmg.guide ? "npc_justin_broken" : "npc_justin") + " float-left'></div>" + step.content + "</div>"; step.content = "<div><div class='" + (env.worldDmg.guide ? "npc_justin_broken" : "npc_justin") + " float-left'></div>" + step.content + "</div>";
$(step.element).popover('destroy'); // destroy existing hover popovers so we can add our own $(step.element).popover('destroy'); // destroy existing hover popovers so we can add our own
step.onShow = function(){ step.onShow = function(){
Analytics.track({'hitType':'event','eventCategory':'behavior','eventAction':'tutorial','eventLabel':k+'-web','eventValue':i+1,'complete':false});
// step.path doesn't work in Angular do to async ui-router. Our custom solution: // step.path doesn't work in Angular do to async ui-router. Our custom solution:
if (step.state && !$state.is(step.state)) { if (step.state && !$state.is(step.state)) {
// $state.go() returns a promise, necessary for async tour steps; however, that's not working here - have to use timeout instead :/ // $state.go() returns a promise, necessary for async tour steps; however, that's not working here - have to use timeout instead :/
$state.go(step.state); $state.go(step.state);
return $timeout(function(){}); return $timeout(function(){});
} }
Analytics.track({'hitType':'event','eventCategory':'behavior','eventAction':'tutorial','eventLabel':k+'-web','eventValue':i+1,'complete':false}) };
}
step.onHide = function(){ step.onHide = function(){
if (step.final) { // -2 indicates complete if (step.final) { // -2 indicates complete
var ups={};ups['flags.tour.'+k] = -2; var ups={};ups['flags.tour.'+k] = -2;
@@ -194,7 +194,7 @@ function($rootScope, User, $timeout, $state, Analytics) {
} }
} }
}) })
}) });
var tour = {}; var tour = {};
_.each(chapters, function(v,k){ _.each(chapters, function(v,k){