google-analytics-plugin: Not work with me

  initializeApp() {
    this.platform.ready().then(() => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      StatusBar.styleDefault();
      Splashscreen.hide();

      GoogleAnalytics.startTrackerWithId('UA-0000000000-0')
         .then(() => {
           console.log('Google analytics is ready now');
           // Tracker is ready
           // You can now track pages or set additional information such as AppVersion or UserId
           GoogleAnalytics.setAllowIDFACollection(true);
         })
         .catch(e => console.log('Error starting GoogleAnalytics', e));

    });

  }

not work with me use this plugin

try with emulator android e web serve

Error starting GoogleAnalytics cordova_not_available

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 25

Most upvoted comments

ionic serve will never work; the api only work in the emulator or device

second: you should check the android development env, to see if the GoogleAnalytics api is installed, so it can be used in the emulator.