mirror of
https://github.com/grafana/grafana.git
synced 2024-12-02 05:29:42 -06:00
28 lines
577 B
JavaScript
28 lines
577 B
JavaScript
define([
|
|
'angular',
|
|
'../core_module',
|
|
],
|
|
function(angular, coreModule) {
|
|
'use strict';
|
|
|
|
coreModule.default.service('googleAnalyticsSrv', function($rootScope, $location) {
|
|
var first = true;
|
|
|
|
this.init = function() {
|
|
$rootScope.$on('$viewContentLoaded', function() {
|
|
// skip first
|
|
if (first) {
|
|
first = false;
|
|
return;
|
|
}
|
|
window.ga('send', 'pageview', { page: $location.url() });
|
|
});
|
|
};
|
|
|
|
}).run(function(googleAnalyticsSrv) {
|
|
if (window.ga) {
|
|
googleAnalyticsSrv.init();
|
|
}
|
|
});
|
|
});
|