我一直在使用Google Analytics来跟踪我的移动应用使用情况。我使用Rhomobile构建它(类似于Phonegap),它使用WebView
来显示UI。我在第一页上粘贴了Google Analytics javascript代码,它在iOS4到6和Android 2.3及更低版本上运行得非常好。但是,没有针对任何Android 4+设备报告的统计信息。我的应用可以访问Internet。有任何想法吗? Android 4是否阻止了Google Analytics的使用?
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXX-Y']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
答案 0 :(得分:1)
我明白了。你需要添加:
_gaq.push(['_setDomainName', 'none']);
前
_gaq.push(['_trackPageview']);
它至少可以在Android 4.1.1上运行。