title: Implementing Google Analytics in Ionic 5 with Capacitor
body: <p>I am trying to implement the GA on an ionic project for days now without any luck.</p>
  <p>I need this to work in the browser (PWA) and Android platforms.</p>
  <p>Let's start with what docs say:
  <a href="https://ionicframework.com/docs/native/google-analytics" rel="noreferrer">https://ionicframework.com/docs/native/google-analytics</a></p>
  <p>Capacitor:</p>
  <p><code>npm install cordova-plugin-google-analytics</code></p>
  <p><code>npm install @ionic-native/google-analytics</code></p>
  <p><code>ionic cap sync</code></p>
  <pre><code>import { Plugins } from '@capacitor/core';
  const { GoogleAnalytics } = Plugins;
  
  ... 
  
  initializeApp() {
      GoogleAnalytics.startTrackerWithId('G-0000000000')
      .then(() =&gt; {
          alert('Google analytics is ready now');
      })
     .catch(e =&gt; alert(e));
  </code></pre>
  <p>After this I get the following error :</p>
  <p><strong>GoogleAnalytics does not have web implementation.</strong></p>
  <p>If I do the Cordova implementation all I got is that
  <strong>cordova_not_available</strong></p>
  <p>Tried to register the WebPlugin</p>
  <pre><code>import { Plugins } from '@capacitor/core';
  import { registerWebPlugin } from '@capacitor/core';
  const { GoogleAnalytics } = Plugins;
  registerWebPlugin(GoogleAnalytics);
  </code></pre>
  <p>However, the compiler threw an error</p>
  <pre><code>ERROR in app.component.ts:159:25 - error TS2345: 
  Argument of type '{ [prop: string]: any; }' is not assignable to parameter of type 'WebPlugin'.
  Type '{ [prop: string]: any; }' is missing the following properties from type 
  'WebPlugin': config, loaded, listeners, windowListeners, and 9 more. 
  </code></pre>
  <p>Why do I get these errors when docs say it supposed to work in the browser(PWA) ?</p>
  <p>Ionic info:</p>
  <pre><code>Ionic CLI                     : 5.4.16
  Ionic Framework               : @ionic/angular 5.3.2
  @angular-devkit/build-angular : 0.1001.1
  @angular-devkit/schematics    : 8.1.3
  @angular/cli                  : 10.1.1
  @ionic/angular-toolkit        : 2.3.3
  
  Capacitor CLI   : 1.5.3
  @capacitor/core : 1.5.3
  
  Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
  Cordova Platforms : android 8.1.0, browser 6.0.0
  Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 12 
  other plugins)
  
  cordova-res (update available: 0.15.1) : 0.9.0
  native-run (update available: 1.0.0)   : 0.2.9
  
  
  Android SDK Tools : 26.1.1
  NodeJS            : v12.13.1
  npm               : 6.12.1
  OS                : Windows 10
  </code></pre>