We've used the scripttags in header and body and that seems to work when calling the application with the direct (mendixcloud.com) URL.
Our application is embedded (iframed) in another website, and it looks like Google doesn't like this. Especially because the website itself already had GTM.
Some how, we can not get it working correctly.
We also found that it was not suitable, but served as an excellent base to start a new widget with more configurability. Ours needed custom events per page and custom configs for GTM codes and custom events per tenant