[英]Cordova Google-analytics-plugin with ionic in Android does not work
I have trouble with getting my cordova/ionic android app to work with google analytics. 我无法让我的cordova / ionic android应用程序与谷歌分析一起使用。 For now I have tried GAPlugin with anulartics without success, and now I am trying simpler setup with https://github.com/danwilson/google-analytics-plugin
目前我已经尝试过使用anulartics的GAPlugin但没有成功,现在我正在尝试使用https://github.com/danwilson/google-analytics-plugin
更简单的设置
In my ionic angular app, I have added following code in 在我的离子角应用程序中,我添加了以下代码
.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 be workling correctly, following is output of adb -s BH9XXXXJ0D logcat | grep GAV3
并且似乎正确处理,以下是adb -s BH9XXXXJ0D logcat | grep GAV3
输出 adb -s BH9XXXXJ0D logcat | grep GAV3
looks like it connects to google analytics, sends 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 as Mobile App. Google分析属性设置为移动应用。
ionic is 2.5 cordova 3.6.3-0.2.13 android 4.4.4 phone xperia z1 javac 1.7.0_65 OpenJDK Runtime Environment (IcedTea 2.5.2) (7u65-2.5.2-3~14.04) on Ubuntu 14.04 64bit 离子是2.5 cordova 3.6.3-0.2.13 android 4.4.4手机xperia z1 javac 1.7.0_65 OpenJDK运行环境(IcedTea 2.5.2)(7u65-2.5.2-3~14.04)在Ubuntu 14.04 64bit
Any idea what might be wrong? 知道什么可能是错的吗? Or how to debug it more to see if google analytics is receiving my messages? 或者如何调试它以查看Google Analytics是否正在接收我的消息?
Looks like it was my own wishful thinking at fault. 看起来这是我自己的一厢情愿的错误。 While it is said in documentation that app data will appear in analytics only after 24 hours, I somehow thought that it does not apply to 'Real-time' tab. 虽然在文档中说应用数据仅在24小时后出现在分析中,但我不知何故认为它不适用于“实时”选项卡。 It does. 确实如此。 After 24 hours, Realtime data shows up with delay of seconds, but not earlier. 24小时后,实时数据会显示延迟秒,但不会更早。
Some answers in related questions claim the opposite. 相关问题中的一些答案则相反。 Do not take it for granted, as I did. 不要像我一样把它视为理所当然。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.