Revert "feat(analytics): Analytics service"

This reverts commit 9a0e31db40.
This commit is contained in:
Sabe Jones
2015-06-22 14:14:33 -05:00
parent 78689e6e7c
commit 56a461c513
13 changed files with 76 additions and 56 deletions

View File

@@ -5,8 +5,8 @@
*/
angular.module('habitrpg')
.controller("AuthCtrl", ['$scope', '$rootScope', 'User', '$http', '$location', '$window','ApiUrl', '$modal', 'Analytics',
function($scope, $rootScope, User, $http, $location, $window, ApiUrl, $modal, Analytics) {
.controller("AuthCtrl", ['$scope', '$rootScope', 'User', '$http', '$location', '$window','ApiUrl', '$modal',
function($scope, $rootScope, User, $http, $location, $window, ApiUrl, $modal) {
$scope.logout = function() {
localStorage.clear();
@@ -47,14 +47,14 @@ angular.module('habitrpg')
$http.post(url, scope.registerVals).success(function(data, status, headers, config) {
runAuth(data.id, data.apiToken);
if (status == 200) {
Analytics.register();
mixpanel.alias(data._id);
if (data.auth.facebook) {
Analytics.updateUser({'email':data.auth.facebook._json.email,'language':data.preferences.language});
Analytics.track({'hitType':'event','eventCategory':'acquisition','eventAction':'register','authType':'facebook'});
mixpanel.register({'authType':'facebook','email':data.auth.facebook._json.email})
} else {
Analytics.updateUser({'email':data.auth.local.email,'language':data.preferences.language});
Analytics.track({'hitType':'event','eventCategory':'acquisition','eventAction':'register','authType':'email'});
mixpanel.register({'authType':'email','email':data.auth.local.email})
}
mixpanel.register({'UUID':data._id,'language':data.preferences.language});
mixpanel.track('Registration');
}
}).error(errorAlert);
};
@@ -68,15 +68,15 @@ angular.module('habitrpg')
.success(function(data, status, headers, config) {
runAuth(data.id, data.token);
if (status == 200) {
Analytics.login();
Analytics.updateUser();
Analytics.track({'hitType':'event','eventCategory':'behavior','eventAction':'login'});
mixpanel.identify(data.id);
mixpanel.register({'UUID':data._id});
mixpanel.track('Login');
}
}).error(errorAlert);
};
$scope.playButtonClick = function(){
Analytics.track({'hitType':'event','eventCategory':'button','eventAction':'click','eventLabel':'Play'})
window.ga && ga('send', 'event', 'button', 'click', 'Play');
if (User.authenticated()) {
window.location.href = ('/' + window.location.hash);
} else {
@@ -144,9 +144,9 @@ angular.module('habitrpg')
$http.post(ApiUrl.get() + "/api/v2/user/auth/social", auth)
.success(function(data, status, headers, config) {
if (status == 200) {
Analytics.login();
Analytics.updateUser();
Analytics.track({'hitType':'event','eventCategory':'behavior','eventAction':'login'});
mixpanel.identify(data.id);
mixpanel.register({'UUID':data._id});
mixpanel.track('Login');
}
runAuth(data.id, data.token);
}).error(errorAlert);