Google Analytics don't collect data or feedback

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');
  }
})

You can put the initialization code in run block and wait for deviceready

app.run(function(){
   ionic.Platform.ready(function(){
      googleAnayticInit();
   });
});

Also all methods of analytics plugin takes success and error handlers. You can pass one to see if the method is successful or is there any error.