How does one go about setting analytics up on an angulardart web application? I read Tracking Google Analytics Page Views with Angular.js but there isn't a $scope in angulardart. I'm using ng-view, so I'm guessing I need to somehow push a location to the ga variable, most likely in the RouteInitializer implementation? Maybe in the ngRoute section? I'm unsure. Thanks in advance.
EDIT:
JS:
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXX', 'auto');
ga('send', 'pageview');
window.addEventListener('popstate', function(event) {
ga('send', 'pageview');
});
</script>
ROUTER:
void myRouteInitializer(Router router, RouteViewFactory views) {
views.configure({
'home': ngRoute(
path: '/',
enter: views('views/home.html')),
'challenge': ngRoute(
path: '/challenge/:challengeId',
enter: views('views/view_challenge.html')),
'completed': ngRoute(
path: '/completed',
enter: views('views/completed.html')),
'404': ngRoute(
defaultRoute: true,
enter: (RouteEnterEvent e) => router.go('home', {}, replace: true))
});