Analytics is key for any successful application; it helps understand which screens are most visited and which products users took interest in the most. We can track many different events that a user does while using the application:
$ ionic cordova:plugin add cordova-plugin-google- analytics$ npm install @ionic-native/google-analytics --save
Let's start by initializing the plugin in app.component.ts, here we will set the GoogleAnalytics tracking ID and this will get us started:
// src/app/app.component.tsimport { GoogleAnalytics } from '@ionic-native/google-analytics'; constructor(private ga: GoogleAnalytics) { } platformReady() { // Call any initial plugins when ready this.platform.ready().then(() => { Splashscreen.hide(); ...