Ionic 4 + Google Analytics plugin- trackView does not work in realtime

201 views Asked by At

I'm trying to implement Google Analytics tracking in my Ionic 4 app (with the native plugin). I have generated the tracking code and in my app.component.ts I have this:

this.ga.startTrackerWithId(environment.ga)
.then(() => { 
    console.log('started track!');
    this.ga.trackView('App component')
    .then(() => { console.log('track view')})
    .catch(e => console.log(e));

    this.ga.trackEvent('root', 'open')
    .then(() => { console.log('track event')})
    .catch(e => console.log(e));
})
.catch(e => alert('Error starting GoogleAnalytics == '+ e));

the startTrackerWithId method runs ok, I can see in the Analytics real-time console a new user is active. The trackEvent works fine, too; the event 'root' is shown in the console. But the trackView does not work. No view is tracked in the console, and when I open the Chrome' s console, no request is being made to the Analytics server. But the 'console.log('track view')' is being called, in other words, no error is being thrown. Any clue?

0

There are 0 answers