google-analytics-plugin
google-analytics-plugin copied to clipboard
PhoneGap Build
I'm trying to setting the "cordova-plugin-google-analytics" plugin, but I can't see nothing in the real time control panel of Google Analytics when I open the app.
I've insert in the config.xml:
<plugin name="cordova-plugin-google-analytics" source="npm" spec="~1.8.3" />
In the html page, before of </head>
:
<script>
document.addEventListener("deviceready", function(){ window.ga.startTrackerWithId('UA-XXXXXX-XX', 30); window.ga.trackView('index.html', 'Home'); }, false);
</script>
Where I wrong? I'm using PhoneGap Build and Framework7 (iOS/Android) with the last cli-8.0.0. Thanks
These are the whitelist settings about config.xml
<allow-intent href="http://*/*"/>
<allow-intent href="https://*/*"/>
<allow-intent href="tel:*"/>
<allow-intent href="sms:*"/>
<allow-intent href="mailto:*"/>
<allow-intent href="geo:*"/>
<platform name="android">
<allow-intent href="market:*"/>
</platform>
<platform name="ios">
<allow-intent href="itms:*"/>
<allow-intent href="itms-apps:*"/>
</platform>
This is the html structure used:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui, viewport-fit=cover">
<title>...</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="theme-color" content="#131313">
<script src="js/vendor/jquery/jquery-2.2.4.min.js"></script>
<script defer src="js/vendor/font-awesome-5/js/fontawesome-all.min.js"></script>
<link rel="stylesheet" href="js/vendor/framework7/css/framework7.min.css">
<link rel="stylesheet" href="js/vendor/framework7-icons/css/framework7-icons.css">
<link rel="stylesheet" href="js/vendor/material-icons/material-icons.css">
<script src="cordova.js" type="text/javascript"></script>
<script type="text/javascript" src="PushNotification.js"></script>
<script type="text/javascript" src="js/variables.js"></script>
<script type="text/javascript" src="js/onesignal.js"></script>
<script type="text/javascript" src="Globalization.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script>
document.addEventListener("offline", function(){ navigator.notification.alert("App offline!\n Check Wi-Fi or cellular data connection.\n You can\'t use this app with \'Airplane\' mode.") }, false);
</script>
<script>
document.addEventListener("deviceready", function(){ window.ga.startTrackerWithId('UA-XXXXXX-XX', 30); window.ga.trackView('index.html', 'Home'); }, false);
</script>
<body id="index" onload="onLoad();init();">
<!-- app root element -->
<div id="app">
...
</div>
<script type="text/javascript" src="js/vendor/framework7/js/framework7.min.js"></script>
</body>
</html>