Localytics events.

master
Nick Sergeant 2015-07-17 12:59:52 -04:00
parent b8dd4336be
commit f1e9ce6702
4 changed files with 28 additions and 1 deletions

View File

@ -37,6 +37,16 @@ jQuery(function($) {
root.app = app; root.app = app;
if (root.location.pathname === '/account/stats/') {
root.ll('tagEvent', 'Viewed stats page');
}
if (root.location.pathname === '/pro/') {
root.ll('tagEvent', 'Viewed Pro page');
}
if (root.location.pathname === '/pro/signup/') {
root.ll('tagEvent', 'Viewed Pro signup page');
}
app.controller('AppController', function($scope) { app.controller('AppController', function($scope) {
$scope.ads = [ $scope.ads = [
{ {

View File

@ -55,6 +55,8 @@
copy: function() { copy: function() {
window.ll('tagEvent', 'Copied snipt');
$('textarea', this.$copyModal).remove(); $('textarea', this.$copyModal).remove();
window.ui_halted = true; window.ui_halted = true;
@ -84,6 +86,8 @@
}, },
edit: function(adding) { edit: function(adding) {
window.ll('tagEvent', 'Edited snipt');
window.editing = true; window.editing = true;
window.ui_halted = true; window.ui_halted = true;
@ -255,6 +259,8 @@
}, },
embed: function() { embed: function() {
window.ll('tagEvent', 'Embedded snipt');
$('textarea', this.$embedModal).remove(); $('textarea', this.$embedModal).remove();
window.ui_halted = true; window.ui_halted = true;
@ -314,6 +320,7 @@
success: function() { success: function() {
that.$el.removeClass('favorited'); that.$el.removeClass('favorited');
that.$favorite.text('Favorite'); that.$favorite.text('Favorite');
window.ll('tagEvent', 'Unfavorited snipt');
}, },
headers: { headers: {
'Authorization': 'ApiKey ' + window.user + ':' + window.api_key 'Authorization': 'ApiKey ' + window.user + ':' + window.api_key
@ -328,6 +335,7 @@
that.$el.addClass('favorited'); that.$el.addClass('favorited');
that.model.set({'favorite_id': resp.id}, {'silent': true}); that.model.set({'favorite_id': resp.id}, {'silent': true});
that.$favorite.text('Favorited'); that.$favorite.text('Favorited');
window.ll('tagEvent', 'Favorited snipt');
}, },
headers: { headers: {
'Authorization': 'ApiKey ' + window.user + ':' + window.api_key 'Authorization': 'ApiKey ' + window.user + ':' + window.api_key
@ -655,6 +663,8 @@
}, },
addNewSnipt: function() { addNewSnipt: function() {
window.ll('tagEvent', 'Added snipt');
var $articleNewSnipt = $('article#new-snipt'); var $articleNewSnipt = $('article#new-snipt');
if ($articleNewSnipt.length === 0) { if ($articleNewSnipt.length === 0) {

View File

@ -20,6 +20,11 @@
$scope.$root.account = response.data; $scope.$root.account = response.data;
$scope.$root.$watch('account.list_view', function(newView, oldView) { $scope.$root.$watch('account.list_view', function(newView, oldView) {
if (oldView !== newView) { if (oldView !== newView) {
if (newView === 'N') {
window.ll('tagEvent', 'Switched to normal view');
} else {
window.ll('tagEvent', 'Switched to compact view');
}
AccountStorage.saveAccount($scope.$root.account, ['list_view']).then(function(response) { AccountStorage.saveAccount($scope.$root.account, ['list_view']).then(function(response) {
$scope.$root.account = response.data; $scope.$root.account = response.data;
}); });

View File

@ -7,7 +7,9 @@
(s = y.createElement(t)).type = 'text/javascript'; (s = y.createElement(t)).type = 'text/javascript';
s.src = '//web.localytics.com/v3/localytics.js'; s.src = '//web.localytics.com/v3/localytics.js';
(c = y.getElementsByTagName(t)[0]).parentNode.insertBefore(s, c); (c = y.getElementsByTagName(t)[0]).parentNode.insertBefore(s, c);
ll('init', 'a62d3f2d950818261a89f2f-70c7cac4-2c9f-11e5-de49-00f078254409', {} /* Options */); ll('init', 'a62d3f2d950818261a89f2f-70c7cac4-2c9f-11e5-de49-00f078254409', {
trackPageView: true
} /* Options */);
}(window, document, 'script', 'll'); }(window, document, 'script', 'll');
</script> </script>
<script type="text/javascript"> <script type="text/javascript">