Google Analytics Plugin Not Reporting any User in the Dashboard


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) {    
if(window.StatusBar) {

if(typeof analytics !== undefined) {                
            console.log("Analytics Initialized");
        } else {
            console.log("Google Analytics Unavailable");

googleanalyticsApp.controller('ExampleController', function($scope,$cordovaGoogleAnalytics) {
function _waitForAnalytics(){

      if(typeof analytics !== 'undefined'){         
       analytics.trackView('APP first screen');          
       console.log("Analytics in Controller");







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.


A couple things come to mind. For one, if you check the documentation for that plugin ( it tells you specifically not to use analytics

v1.0.0 – api change from to, ‘analytics’ is deprecated since 1.0.0 and you should use the new api ‘ga’, because in the next release we are removing the analytics.

Also all the examples given in the documentation don’t use analytics, example:‘UA-XXXX-YY’)

So I would start by following the documentation.

If that fails, in Google Analytics you’re looking at Audience Overview, you’d be better of looking under Real Time, because that updates in real time. You might not see anything on the screen you’ve shown here for a while.

Finally, if all that somehow fails, use to turn on verbose logging, and use logcat to see what errors may be logged with the Google Analytics SDK. With debug mode on you will see lots of logs and should be able to determine the issue.

P.S. As a side note, a lot of your code is really bad. For one typeof analytics will never be undefined. It might be "undefined" or analytics itself might be undefined, but your if block will always run, whether analytics exists or not.

In your controller you actually have the if check there correctly, with 'undefined' instead of undefined, but that code is a complete nightmare…instead of doing that insanity, just check if the platform is ready:

$ionicPlatform.ready(function() {'APP first screen');   


Hi @rlouie,
Thanks for the reply. I added your recommendations.

   'APP first screen');  
            console.log("Analytics Initialized");

But, still NO LUCK.
I called adb logcat after ionic run android, but got a ton of logcat data and i am unable to find out where is the error related to Google Analytics Plugin.
Would really appreciate your help in this.



You need to filter down your logs to your app and look at the logs. There being a lot of logs is not really an excuse to not look through them. It’s the only thing that will point to the answer at this point I believe.

Here are some tips on filtering the logs down:


Thanks. It started working after a long time. Dont know what happened :smiley:


how it’s working with you? what you did to make it work?


Solved it.

$cordova platform add android
$cordova platform update android@6.1.0
$cordova platform add cordova-plugin-google-analytics


The reason was the Cordova Version.
See the solution below