Hello,
Im using the following plugin cordova-plugin-google-analytics
I have some problem with Google analytics, I use the code below in app.js , then use “ionic run android” on my phone to test. When I checked my analytics account, no data or feedback show on Google Analytics dashboard.
There is no message that indicated any error or that the plugin cant not be loaded?
All idea and help are welcome.
thank you in advance.
// Initialize Google Analytics plugin
function _waitForAnalytics(){
if(window.analytics){
var tracking_ID = device.platform == "Android" ? "UA-XXXXXXXX-X" :"UA-XXXXXXXX-X";
window.analytics.debugMode();
window.analytics.startTrackerWithId(tracking_ID);
window.analytics.setUserId(window.user);
window.analytics.trackView('home');
console.log("GA activated");
}
else{
setTimeout(function(){
_waitForAnalytics();
},250);
}
}
_waitForAnalytics();
This is what i use in controllers.js
if(window.analytics){
window.analytics.setUserId(userID);
window.analytics.trackView('HomeScreen');
}
})