Cordova google analytics-plugin with ionic in android not working
I'm having trouble connecting my cordova / ionic android app to work with Google Analytics. At the moment I have tried GAPlugin with anulartics without success and now I am trying to simplify the setup withhttps://github.com/danwilson/google-analytics-plugin
In my ionic angular app, I added the following code to
.run(function($ionicPlatform) {
if (typeof analytics !== 'undefined'){
analytics.startTrackerWithId('UA-55MYNUMB8-1');
analytics.trackView('testapmain');
console.log("starting analytics");
analytics.debugMode()
}
else
{
console.log("Google Analytics plugin could not be loaded.")
}
}
and it seems to work correctly, the following is the output adb -s BH9XXXXJ0D logcat | grep GAV3
looks like it connects to google analytics, send message
V/GAV3 (12570): Thread[client_id_fetcher,5,main]: Storing clientId.
I/GAV3 (12703): Thread[GAThread,5,main]: No campaign data found.
V/GAV3 (12570): Thread[GAThread,5,main]: connecting to Analytics service
V/GAV3 (12570): Thread[main,5,main]: service connected, binder: android.os.BinderProxy@4483eda8
V/GAV3 (12570): Thread[main,5,main]: bound to service
V/GAV3 (12570): Thread[GAThread,5,main]: connect: bindService returned true for Intent { act=com.google.android.gms.analytics.service.START cmp=com.google.android.gms/.analytics.service.AnalyticsService (has extras) }
V/GAV3 (12570): Thread[GAThread,5,main]: Loaded clientId
V/GAV3 (12570): Thread[main,5,main]: Connected to service
I/GAV3 (12570): Thread[GAThread,5,main]: No campaign data found.
V/GAV3 (12570): Thread[GAThread,5,main]: putHit called
V/GAV3 (12570): Thread[GAThread,5,main]: Sending hit to service PATH: https: PARAMS: v=1, ul=en-us, t=appview, ht=1412010481966, sr=1080x1776, an=testa, tid=UA-55215798-3, aid=com.ionicframework.testa300342, cid=05b7c4d9-b3b3-4ea8-9f04-dfa61c6853ec, av=0.0.1, _u=.KnoK-AL, cd=testapmain,
but nothing shows up in google analytics. Google Analytic Property is set to Mobile App.
ionic - 2.5 cordova 3.6.3-0.2.13 android 4.4.4 phone xperia z1 javac 1.7.0_65 OpenJDK working environment (IcedTea 2.5.2) (7u65-2.5.2-3 ~ 14.04) on Ubuntu 14.04 64bit
Any idea what could be wrong? Or how can I debug it more to see if Google Analytics is receiving my posts?
source to share
It looks like it was my own wishful thinking. Although the documentation states that the application data will only appear in analytics after 24 hours, for some reason I thought this was not the case for the "Live" tab. It does. After 24 hours, real-time data appears with a delay in seconds, but not earlier.
Some answers in related questions state the opposite. Don't take it for granted, as I do.
source to share