google-analytics-plugin
google-analytics-plugin copied to clipboard
anaylitcs doesn't show page view name using trackView
Hi there!
I'm using Ionic 3 and I want to track each page of my application.
In my app.components.ts
once platform is ready, I am initializing the plugin as follows:
private startAnalytics() {
// start analytics
this.analytics.startTrackerWithId('XX-XXXXXXXXX-X') // I put my real ID here
.then(() =>
{
console.log('Google analytics now enabled');
},
() =>
{
console.log('Google analytics failed to start');
});
}
Then, in each page, I inject the GoogleAnalytics
object and in the ionViewDidLoad
method I call trackView
method.
In google analytics dashboard I can see I have page views but when I go to pages report it says page title is (not set)
.
I'm afraid I am misusing this somehow or there is something I am missing here.
@Boredude it will update within 24 hours. But you can see the data in "Real Time" sidebar menu.
I have the same problem, I can track events but not pages/views. I can even follow it in the Real Time dashboard and see that I have 1 active user but no active page. I have also tried waiting a couple of days for the data to appear in the standard view, but still no pages.
I have enabled debugmode and the output looks successful to me. Even the promise from the trackView method returns successfully, but no view appears in Google Analytics. I even tried downgrading to v1.7.11 but the issue remains.
I have tried sending data with the trackView method and I've tried just sending the name of the view but none of the methods work.
Is this a problem with the plugin, the Ionic wrapper or with Google Analytics?
Ionic info:
cli packages: (/Users/timmyrosen/Sites/kalmar-omsorg/node_modules)
@ionic/cli-utils : 1.9.2
ionic (Ionic CLI) : 3.9.2
global packages:
Cordova CLI : 7.0.1
local packages:
@ionic/app-scripts : 2.1.3
Cordova Platforms : android 6.2.3 ios 4.4.0
Ionic Framework : ionic-angular 3.6.0
System:
ios-deploy : 1.9.1
Node : v8.4.0
npm : 5.3.0
OS : macOS Sierra
Xcode : Xcode 8.3.3 Build version 8E3004b
@timmyrosen can you please tell me how you are able to track events ? I am not able to track events.
Please everybody check the issue #420, this is related to the new change of Google to firebase platform.
@victorsosa Thanks for the reference! creating a new "View" and setting it to track "Mobile app" did the trick!
Thanks
@victorsosa Thank you, that solved the issue!
Here the problem persist :( --Edit Magically it's working now. I think the delay was my problem. In real time, delay is about 3 minutes for track. How can I improve it?
@rafwell i think that delay is caused by the way how android works internally with network. Google Cloud Messaging - enabled apps' requests are sent as batches, and android system scheduler decides when to send next batch. So, i think you have no control here. Unless you'll implement TCP/IP connectivity by your own, but there is a risk that battery will dry sooner with custom network implementation.
Will there also be a delay in the Status under "Tracking Code" section under Admin > Tracking Js? It has been about 10 hours since I have added the tracking info and the section says
Status No data received in past 48 hours. Learn more
Has anyone else seen the same behavior? I am not doing anything complex. I added this in my deviceready window.ga.startTrackerWithId(Id, 1);
then I added this script to the bottom of my index.html page window.ga.trackView('Home');
Thanks for your help
I got it to work. I had to add a timeout or use the success method. Example,
window.ga.startTrackerWithId('UA-XX-X', 1, function(msg) {
window.ga.trackView('Index.html');
});
But now I am facing another problem. One a different page, in the document.ready function, when I call window.ga.trackView('Favorites') it fails and all code after the call does not run. Do I need to add something on page 2?
I got it to work. I had to add a timeout or use the success method. Example,
window.ga.startTrackerWithId('UA-XX-X', 1, function(msg) { window.ga.trackView('Index.html'); });
But now I am facing another problem. One a different page, in the document.ready function, when I call window.ga.trackView('Favorites') it fails and all code after the call does not run. Do I need to add something on page 2?
Did you get an answer to this question ? I am also looking for same.