I've been using Google Analytics to track my mobile app usage. I built it with Rhomobile (similar to Phonegap) and it uses a WebView
to display the UI. I pasted the Google Analytics javascript code in the first page and it works perfectly fine on iOS4 to 6 and Android 2.3 and less. However, no stats are reported for any Android 4+ devices. My app has Internet access. Any ideas? Is Android 4 blocking this usage of 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>