Ionic + google analytics - issue


I’ve developed web application using Ionic 3 (working great), and I’m currently facing issue, when I’m trying to plug Google Analytics. As I’m deploying app for web application, I don’t have cordova available, so I cannot use Ionic/cordova plugins. Does anyone have experience with it and can share some thougs/ideas?

Have a look at the source of at the index.html.

When we are in Cordova mode we use the GA plugin, when we are in web mode we us a standard GA web implementation.

The part I have not figured out is how to chang the Index file depending on wether I am doing a native or web build. Currently I have a separate branch for my PWA where the cordova.js is commented out and the google analytics is uncommented. Let me know if that works for you…