Add mixpanel events to the tutorial.

This commit is contained in:
jakedt 2014-02-13 17:27:50 -05:00
parent fe6b766ff1
commit 41a173ae85
2 changed files with 23 additions and 6 deletions

View file

@ -79,7 +79,8 @@ function TutorialCtrl($scope, AngularTour, AngularTourSignals, UserService) {
return message['data']['action'] == 'login'; return message['data']['action'] == 'login';
}), }),
'waitMessage': "Waiting for docker login", 'waitMessage': "Waiting for docker login",
'skipTitle': "I'm already logged in" 'skipTitle': "I'm already logged in",
'mixpanelEvent': 'tutorial_start'
}, },
{ {
'title': 'Step 2: Create a new container', 'title': 'Step 2: Create a new container',
@ -100,7 +101,8 @@ function TutorialCtrl($scope, AngularTour, AngularTourSignals, UserService) {
} }
return pushing; return pushing;
}), }),
'waitMessage': "Waiting for repository push to begin" 'waitMessage': "Waiting for repository push to begin",
'mixpanelEvent': 'tutorial_wait_for_push'
}, },
{ {
'title': 'Push in progress', 'title': 'Push in progress',
@ -115,7 +117,8 @@ function TutorialCtrl($scope, AngularTour, AngularTourSignals, UserService) {
'title': 'Step 5: View the repository on Quay.io', 'title': 'Step 5: View the repository on Quay.io',
'templateUrl': '/static/tutorial/view-repo.html', 'templateUrl': '/static/tutorial/view-repo.html',
'signal': AngularTourSignals.matchesLocation('/repository/'), 'signal': AngularTourSignals.matchesLocation('/repository/'),
'overlayable': true 'overlayable': true,
'mixpanelEvent': 'tutorial_push_complete'
}, },
{ {
'content': 'Waiting for the page to load', 'content': 'Waiting for the page to load',
@ -131,7 +134,8 @@ function TutorialCtrl($scope, AngularTour, AngularTourSignals, UserService) {
{ {
'title': 'Repository View', 'title': 'Repository View',
'content': 'This is the repository view page. It displays all the primary information about your repository.', 'content': 'This is the repository view page. It displays all the primary information about your repository.',
'overlayable': true 'overlayable': true,
'mixpanelEvent': 'tutorial_view_repo'
}, },
{ {
'title': 'Image History', 'title': 'Image History',
@ -161,7 +165,8 @@ function TutorialCtrl($scope, AngularTour, AngularTourSignals, UserService) {
{ {
'title': 'Repository Admin', 'title': 'Repository Admin',
'content': "The repository admin panel allows for modification of a repository's permissions, webhooks, visibility and other settings", 'content': "The repository admin panel allows for modification of a repository's permissions, webhooks, visibility and other settings",
'overlayable': true 'overlayable': true,
'mixpanelEvent': 'tutorial_view_admin'
}, },
{ {
'title': 'Permissions', 'title': 'Permissions',
@ -178,7 +183,8 @@ function TutorialCtrl($scope, AngularTour, AngularTourSignals, UserService) {
}, },
{ {
'templateUrl': '/static/tutorial/done.html', 'templateUrl': '/static/tutorial/done.html',
'overlayable': true 'overlayable': true,
'mixpanelEvent': 'tutorial_complete'
} }
] ]
}; };

View file

@ -134,6 +134,15 @@ angular.module("angular-tour", [])
}); });
}; };
var fireMixpanelEvent = function() {
if (!$scope.step || !mixpanel) { return; }
var eventName = $scope.step['mixpanelEvent'];
if (eventName) {
mixpanel.track(eventName);
}
};
$scope.setStepIndex = function(stepIndex) { $scope.setStepIndex = function(stepIndex) {
// Close existing spotlight and signal timer. // Close existing spotlight and signal timer.
teardownSignal(); teardownSignal();
@ -149,6 +158,8 @@ angular.module("angular-tour", [])
$scope.step = $scope.tour.steps[stepIndex]; $scope.step = $scope.tour.steps[stepIndex];
fireMixpanelEvent();
// If the signal is already true, then skip this step entirely. // If the signal is already true, then skip this step entirely.
setupSignal(); setupSignal();
if (checkSignal()) { if (checkSignal()) {