Last active
December 16, 2015 23:30
-
-
Save revolunet/5514543 to your computer and use it in GitHub Desktop.
Sample angular-google-analytics usage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app = angular.module('app', ['angular-google-analytics']) | |
.config(function(AnalyticsProvider) { | |
// initial configuration | |
AnalyticsProvider.setAccount('UA-XXXXX-xx'); | |
// track all routes (or not) | |
AnalyticsProvider.trackPages(true); | |
})) | |
.controller('SampleController', function(Analytics) { | |
// create a new pageview event | |
Analytics.trackPage('/video/detail/XXX'); | |
// create a new tracking event | |
Analytics.trackEvent('video', 'play', 'django.mp4'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment