Tracker service: (function () { 'use strict'; angular .module('app.core') .service('googleAnalyticsTracker', googleAnalyticsTracker); googleAnalyticsTracker.$inject = ['$state', '$window']; function googleAnalyticsTracker($state, $window) { /* jshint validthis: true */ this.trackState = trackState; //////////////// function trackState() { var stateName = $state.current.name; var path = stateName.replace(/\./g, '/'); // replaces dots to mimic regular path with slashes $window.ga('set', 'page', path); $window.ga('send', 'pageview'); } […]
Tag Archives: Google Analytics
Google Analytics and Angular UI Router
20-Mar-17The new asynchronous tracking in Google Analytics requires new code as well. If you need to track more than one profile, this is how you do it.
Sometimes you need to use many Analytics site profiles to track the same information, for any reason. One instance is using tools like SEO Position Plus which may require a profile of its own. Here's one way to do it with the new tracking code (not the legacy tracking, for that see this thread). <script […]