I am building a Shopify app for installing google tag manager scripts. The scripts are generated on a few parameters in the back-end so users enters gtm-id / domain in the front-end and this generates a head code and a body code.
Now I want to insert this code in all pages of the customer shopify store.
I saw the script tags api but seems not recommend anymore. Next step I did was generate a extension and under blocks created my files. But these come with 2 problems
- How to place my dynamic script instead of a static script
- The user needs to enable it on a separate page ( the less clicks the better sow can I do this with the api)