I developed a Shopify application that i install on Shopify Store and i want my application to add a javascript snippet in all the store pages. For this I want my application to modify the current theme, by using Shopify API, and add the javascript snippet to that theme.
I know of several ways to do it but they have several disadvantage:
- Add a Shopify Asset/Snippet - The store owner has to manually modify the store's theme to link to the asset/snippet.
- Add a script tag - I want my javascript to be embedded and not to be downloaded from a different source. A different source means longer page loads and i do not want my site to extend the page load.
- Add an application proxy - This can also extend the loading time.
Can you suggest on what is the correct way to do it?