diff --git a/src/main/webapp/js/controllers.js b/src/main/webapp/js/controllers.js index ee7cca2d..cf9e82b5 100644 --- a/src/main/webapp/js/controllers.js +++ b/src/main/webapp/js/controllers.js @@ -278,8 +278,10 @@ function($scope, $http, $state, $stateParams, $route, $location, }]); module.controller('FeedListCtrl', ['$scope', '$stateParams', '$http', '$route', - '$window', 'EntryService', 'SettingsService', 'FeedService', 'CategoryService', -function($scope, $stateParams, $http, $route, $window, EntryService, SettingsService, FeedService, CategoryService) { + '$window', 'EntryService', 'SettingsService', 'FeedService', 'CategoryService', 'AnalyticsService', +function($scope, $stateParams, $http, $route, $window, EntryService, SettingsService, FeedService, CategoryService, AnalyticsService) { + + AnalyticsService.track(); $scope.selectedType = $stateParams._type; $scope.selectedId = $stateParams._id; diff --git a/src/main/webapp/js/services.js b/src/main/webapp/js/services.js index 0eaa018e..f6503612 100644 --- a/src/main/webapp/js/services.js +++ b/src/main/webapp/js/services.js @@ -1,5 +1,18 @@ var module = angular.module('commafeed.services', [ 'ngResource' ]); +module.service('AnalyticsService', [ '$state', function($state) { + this.track = function(path) { + path = path || $state.$current.url.prefix; + if (!ga) { + return; + } + ga('send', 'pageview', { + page : path + }); + }; +} ]); + + module.factory('ProfileService', ['$resource', function($resource) { return $resource('rest/user/profile/'); }]);