Hi All,
I am trying to add Google Analytics to my app. I am using Dan Wilson’s Google Analytics plugin. I am not getting any errors but my Google Analytics Dashboard is not Updating at all. Where am i wrong,
var googleanalyticsApp = angular.module('starter', ['ionic','ngCordova'])
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
if(typeof analytics !== undefined) {
analytics.startTrackerWithId("UA-872489XX-1");
console.log("Analytics Initialized");
} else {
console.log("Google Analytics Unavailable");
}
});
});
googleanalyticsApp.controller('ExampleController', function($scope,$cordovaGoogleAnalytics) {
function _waitForAnalytics(){
if(typeof analytics !== 'undefined'){
analytics.startTrackerWithId("UA-87248923-1");
analytics.trackView('APP first screen');
console.log("Analytics in Controller");
}
else{
setTimeout(function(){
_waitForAnalytics();
},250);
}
};
_waitForAnalytics();
I have initialized the Google Analytics in both Device Ready and Controller.
Console.log states as:
But my Dashboard is not updating at all
Kindly, help me out.