2
votes

I'm working a SPA/hybrid App using Ionic+AngluarJs (v1), it's nearly done but now stuck on GTM issue.

GTM provides solution for SPA and it's working well, I can track everything I needed on mobile side (I make the SPA as a mobile site as well, just use content in www folder as a website), however if I build it into Android or IOS, then GTM not working anymore, seems to me after complied, App blocks all request to GTM? But in the SPA I do many external API calls and they are working well.

I searched for help online for a long time but cannot get any idea, I've already tried to add those settings: <allow-navigation href="*" /> <allow-intent href="*" /> <meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'"> in config.xml/index.html according to this document: https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-whitelist/ but not working.

My way to use GTM for SPA/hybrid App is almost the same as in this article: https://www.multiminds.eu/2016/12/06/google-analytics-tag-manager-ionic-cordova/ and I've already make it work well on web pages, why it doesn't after build into App I really confused, it should be just like running a website in a built-in web browser in Android/IOS. Please help me, thank you very much!

1

1 Answers

0
votes

I have found this article about this and it seems to work ok for me, people should stop thinking about cordova apps as native, they are just webviews that have access to native components of the device.

Article:

Google Analytics and Tag Manager with Ionic and Cordova apps