I'm having problems configuring google analytics with my Cordova and Framework7 application.
I have followed several tutorials and answers here on stackoverflow but nothing seems to solve my problem.
The last answer I'm using is this one here: How to use Google Analytics with Phonegap without a plugin?
So in my first row I've this:
<head>
<script async src='https://www.google-analytics.com/analytics.js'></script>
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
var GA_LOCAL_STORAGE_KEY = 'ga:clientId';
ga('create', 'UA-MYCODE-MC', {
'storage': 'none',
'clientId': localStorage.getItem(GA_LOCAL_STORAGE_KEY)
});
ga(function(tracker) {
localStorage.setItem(GA_LOCAL_STORAGE_KEY, tracker.get('clientId'));
});
// THIS IS FOR FILE URL SUPPORT
ga('set', 'checkProtocolTask', function(){ /* noop */});
// And then as usual...
ga('send', 'pageview');
</script>
So when I run in localhost Google Analytics seems to work fine even in real time analytics.
Once I complete the apk and install it in my phone, Google Analytics doesn't seem to receive any data from my application. Am I doing something wrong? Even using the Android developer tools, I don't get any console errors.
It may be related to the fact that on android the url of the app is: file:///android_asset/www/index.html
Thanks.