Skip to content
This repository has been archived by the owner on Nov 22, 2018. It is now read-only.

Commit

Permalink
go-playground: add analytics
Browse files Browse the repository at this point in the history
LGTM=adg
R=adg
CC=golang-codereviews
https://codereview.appspot.com/120700044
  • Loading branch information
campoy committed Aug 7, 2014
1 parent 1c17261 commit a8879d7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 3 additions & 2 deletions static/js/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
angular.module('tour.controllers', []).

// Navigation controller
controller('EditorCtrl', ['$scope', '$routeParams', '$location', 'toc', 'i18n', 'run', 'fmt', 'editor',
function($scope, $routeParams, $location, toc, i18n, run, fmt, editor) {
controller('EditorCtrl', ['$scope', '$routeParams', '$location', 'toc', 'i18n', 'run', 'fmt', 'editor', 'analytics',
function($scope, $routeParams, $location, toc, i18n, run, fmt, editor, analytics) {
var lessons = [];
toc.lessons.then(function(v) {
lessons = v;
Expand Down Expand Up @@ -43,6 +43,7 @@ controller('EditorCtrl', ['$scope', '$routeParams', '$location', 'toc', 'i18n',
}
$location.path('/' + l + '/' + page);
$scope.openFile($scope.curFile);
analytics.trackView();
};
$scope.openFile = function(file) {
$scope.curFile = file;
Expand Down
12 changes: 11 additions & 1 deletion static/js/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@

angular.module('tour.services', []).

// Google Analytics
factory('analytics', ['$window',
function(win) {
var track = win.trackPageview || (function() {});
return {
trackView: track
};
}
]).

// Internationalization
factory('i18n', ['translation',
function(translation) {
Expand Down Expand Up @@ -143,4 +153,4 @@ factory('toc', ['$http', '$q', '$log', 'tableOfContents',
nextLesson: nextLesson
};
}
]);
]);

0 comments on commit a8879d7

Please sign in to comment.