ngCordova Google analytics ($cordovaGoogleAnalytics)


I am trying to use the ‘’ plugin with ngCordova. I have added the plugin and added ngCordova as a dependency in my controller.

when I try to set

I get this error: ‘TypeError: Cannot read property ‘startTrackerWithId’ of undefined’.

I have set my analytics up as a mobile app in the Google dashboard.

Can anybody help with this?


I use it this way that I define the tracking ID when platform is ready. Grab some code:

$ionicPlatform.ready(function() {
  if (typeof analytics !== 'undefined'){

p.s. The above code doesn’t use the ngCordova, just plain Cordova.


Hi @mcneela86,

I agree with @rafaellop in the fact that you don’t necessarily need ngCordova for this task. It might even be better to skip it since the Cordova plugin itself isn’t too complicated.

I had written an article on how to use it a while back:

Should still be relevant in getting this working.



Hi Everyone,

I got this question answered on stack overflow, hope it helps someone else:


Hi, good to hear that you have solved the problem, but I’m curious whether my solution works for you or not?


Hi, I tried with the method above (without using ngcordova) and it worked fine. Thank you for the help.