Remote analytics code in ionic + cordova app

hi, i’m testing if it’s possible to implement analytics through a tag manger in an ionic+cordova app.

i started a example app (ionic start myApp sidemenu), and added a scrip tag to the head of my index.html file, as I would in a regular website. This way i inyect the tag manager code from a remote server.

This works fine when testing the web version with ionic serve (i can see that the analytics object was correctly attatched to window), but it doesn’t when i try deploying the app on android.

could the problem be that i’m trying to use the window object in an android app, and that’s not possible? are there any workarounds? I have no experience with mobile dev so sorry in advance if this is a stupid question.

Thanks for any help