Shopify app inject dynamic head and body tags

Shopify app inject dynamic head and body tags

jeroenfrenken
Shopify Partner
1 0 0

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)

Thanks in advance

Reply 1 (1)

MikM
Shopify Partner
1 0 0

There is a new solution for <head> section of Shopify pages – Head Page Notia app which is free to install and use.

In this app you can add script to all pages or special code for particular page. For example you can add Structure data JSON according Schema.org.