[英]Google Analytics in Android Web app does not work in 4.0 or higher
我一直在使用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>
我想到了。 你需要添加:
_gaq.push(['_setDomainName', 'none']);
之前
_gaq.push(['_trackPageview']);
它至少可以在Android 4.1.1上運行。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.