Flutter教程

Google Analytics

Contents

This plugin connects to Google's native Universal Analytics SDK Prerequisites:

  • A Cordova 3.0+ project for iOS and/or Android
  • A Mobile App property through the Google Analytics Admin Console
  • (Android) Google Play Services SDK installed via Android SDK Manager
https://github.com/danwilson/google-analytics-plugin

联系我们?

If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic's experts offer official maintenance, support, and integration help.

Contact Us Today!

Ionic Google Analytics插件的安装(Installation)

ionic cordova plugin add cordova-plugin-google-analytics npm install @ionic-native/google-analytics
Ionic EE comes with fully supported and maintained plugins from the Ionic Team. Learn More or Contact Us
ionic enterprise register --key=YOURPRODUCTKEY npm install @ionic-enterprise/google-analytics

Ionic Google Analytics插件支持的平台(Supported Platforms)

  • Android
  • Browser
  • iOS
  • Windows Phone 8

Ionic Google Analytics插件的用法(Usage)

import { GoogleAnalytics } from '@ionic-native/google-analytics/ngx';

constructor(private ga: GoogleAnalytics) { }

...

this.ga.startTrackerWithId('YOUR_TRACKER_ID')
   .then(() => {
     console.log('Google analytics is ready now');
      this.ga.trackView('test');
     // Tracker is ready
     // You can now track pages or set additional information such as AppVersion or UserId
   })
   .catch(e => console.log('Error starting GoogleAnalytics', e));