How to POST Shopify ScriptTag to Shopify Theme via public embedded app?

New Member
3 0 0

Question 1

Before I send any ScriptTag do I need to wrap my Javascript file? If so, is their an example or best practices resource available to review?

Question 2

To send the ScriptTag POST to the merchants store should I use a front end AJAX call? 


Am I going to POST to my controller that would then fire off a POST to the ScriptTag via Node HTTP/Fetch?

Shopify Partner
28 1 5

For this, you will need to host the script tag on some type of file storage system such as an S3 bucket. 


So on your node server, you will have a POST to the S3 bucket with the complete script tag that you want on your store. Once that is hosted on S3 or any other file storage system, you then want to take the URL link to the script that was generated from S3 to be your reference to the Shopify Script Tag POST that you will make. Then you should be able to view your script on the storefront.


1) This tutorial helped me understand how to start a proper script tag on Shopify,/shopify/2019/04/24/how-to-create-conditional-script-tags-for-a-sh...


2) You do not do any ajax calls unless your script tag itself requires it for storefront changes. It is not used for injecting the script tag itself.