Google Analytics fails with `undefined` error


#1

I tried adding analytics to my app.

    console.log("Analytics ID", config.googleAnalytics);
    GoogleAnalytics.startTrackerWithId(config.googleAnalytics).then(
        res => console.log("res", res),
        error => console.log("error", error),
    );

Testing using ionic run browser, this is the console output:

Analytics ID - the correct one from google analytics
error undefined

Why does it reject? How can I see the error?


#2

Same issue here… have you found a solution?


#3

Update to version 2.1.4 or above


#4

Version 2.1.4 of Ionic CLI? I have 2.1.18…
It seems there are still open issues?



I also tried using a web GA tracking ID, but in either case I get the “Error: send timeout” when i call GoogleAnalytics.trackView(‘test’);


#5

My appologies. Not 2.1.14, but 2.2.14. You can see in the releases:

google-analytics: fix startTrackerWithId when interval is not provided (49fe24d)

Version is of ionic-native, not ionic-cli


#6

Thanks, I updated to the latest version 2.2.16. But still it doesn’t work, see https://github.com/danwilson/google-analytics-plugin/issues/361#issuecomment-272648497