Ionic 2 RC.0 - Google Analytics


I finally upgraded my app to Ionic 2 RC0 and when i run the app on my Device i get a error in Google Analtycs (work on latest beta)

The plugin is installed

Any have managed to work with RC,0?



Did you manage to get this working?

Struggling with the same problem…




I have a issue open to resolve this problem.


and are your waiting in your source code that the platform is ready before you are using the plugin?

// wait for `ondeviceready` or use `platform.ready()` if you're using Ionic Framework 2
this.platform().then(() => { // we're assuming you injected platform in your constructor
    res => console.log("We have taken a picture!"),
    err => console.error("Error taking picture", err)


Yes. Off Course!


Works now!

But not sure, what exactly caused the problem…

First I ran this (suggested by mlynch here

ionic state reset
rm -rf node_modules
npm install

But I also had an error in my code:
I didn’t wait for the platform/plugins to be ready in my root page.
There I just executed GoogleAnalytics.trackView(‘xxx’) in the constructor.



Ok, the solution for me must have been the steps suggested by mlynch.

The code error (calling trackView in the rootpage before device ready) didn’t cause the complete failure of the analytics plugin.
I’ve tested it, all other calls to the analytics plugin, which are executed on other pages and after the device is ready, do run into google analytics correctly.


And where you put this code?


i have in App.Component.ts and have the same error!


yes, have this code after platform ready in the constructor of app.component.ts too


So for me, don´t work…! It is strange, i have after platform ready and appears to be called before…