1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-25 08:19:40 +02:00

feat(project): add google analytics in app (#599)

This commit is contained in:
Anthony Lapenna 2017-02-14 11:39:26 +13:00 committed by GitHub
parent 85a07237b1
commit 66c574f74d
4 changed files with 50 additions and 9 deletions

View file

@ -12,6 +12,7 @@ angular.module('portainer', [
'angularUtils.directives.dirPagination',
'LocalStorageModule',
'angular-jwt',
'angular-google-analytics',
'portainer.templates',
'portainer.filters',
'portainer.rest',
@ -47,7 +48,7 @@ angular.module('portainer', [
'task',
'templates',
'volumes'])
.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', 'localStorageServiceProvider', 'jwtOptionsProvider', function ($stateProvider, $urlRouterProvider, $httpProvider, localStorageServiceProvider, jwtOptionsProvider) {
.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', 'localStorageServiceProvider', 'jwtOptionsProvider', 'AnalyticsProvider', function ($stateProvider, $urlRouterProvider, $httpProvider, localStorageServiceProvider, jwtOptionsProvider, AnalyticsProvider) {
'use strict';
localStorageServiceProvider
@ -64,6 +65,8 @@ angular.module('portainer', [
});
$httpProvider.interceptors.push('jwtInterceptor');
AnalyticsProvider.setAccount('@@CONFIG_GA_ID');
$urlRouterProvider.otherwise('/auth');
$stateProvider
@ -484,7 +487,7 @@ angular.module('portainer', [
};
});
}])
.run(['$rootScope', '$state', 'Authentication', 'authManager', 'StateManager', 'Messages', function ($rootScope, $state, Authentication, authManager, StateManager, Messages) {
.run(['$rootScope', '$state', 'Authentication', 'authManager', 'StateManager', 'Messages', 'Analytics', function ($rootScope, $state, Authentication, authManager, StateManager, Messages, Analytics) {
StateManager.initialize().then(function success(state) {
if (state.application.authentication) {
authManager.checkAuthOnRefresh();
@ -498,6 +501,11 @@ angular.module('portainer', [
Messages.error("Failure", err, 'Unable to retrieve application settings');
});
$rootScope.$on('$stateChangeSuccess', function (event, toState, toParams, fromState, fromParams) {
Analytics.trackPage(toState.url);
Analytics.pageView();
});
$rootScope.$state = $state;
}])
// This is your docker url that the api will use to make requests