Google Analytics trackEvent() doesn't work


#1

I’m trying to setup Google Analytics on my app. I can see when user open the app, but the events isn’t working.

This is my code:

ionViewDidLoad() {
    this.ga.startTrackerWithId('UA-XXXXX-X')
    .then(() => {
       console.log('Google analytics is ready now');
       this.ga.trackView('My Page');
       this.ga.setAllowIDFACollection(true);
    })
    .catch(e => console.log('Error starting GoogleAnalytics', e));
}
goToPage() {
    this.ga.trackEvent('Navigate', 'PageView', 'Info')
    .then(() => {
        console.log('Track Event ok');
    })
    .....
}

I’m receiving the log “Track Event ok” but I can’t see the event on Google Analytics Console.

Did I forget something?

Thanks!


#2

What plugin are you using?


#3

I’m using the native plugin:


#4

OK, I’m still using ionic1, remember that events are asynchronous, really asynchronous :wink: Sometimes you have to wait for several minutes…