Authorization: Bearer <access_token> (the OAuth token your app received at install) or X-Agent-Key: sq_agt_*. Scopes: read_script_tags, write_script_tags.
A script tag is a remote <script src> loaded asynchronously on every page of the store’s online store. Register a URL and the store loads it. You don’t need to republish or edit the theme.
Endpoints
POST /script_tags: register a script.201when it is new,200with the existing tag when your app already registered thatsrc.GET /script_tags?since_id=&src=&limit=: list your tags, id ascending.limitis 1–250 and defaults to 50.GET /script_tags/count·GET /script_tags/{id}PUT /script_tags/{id}: change thesrc.{ "script_tag": { "src": "https://…" } }DELETE /script_tags/{id}
{ "success": true, "data": { "script_tag": { "id", "src", "event", "display_scope", "cache", "created_at", "updated_at" } } }.
Rules
srcmust be an absolutehttps://URL of at most 2048 characters, with no credentials. The storefront is served over HTTPS, so anhttp://script would be blocked as mixed content.eventisonloadanddisplay_scopeisonline_store. Order-status-page scripts are not supported, matching Shopify’s move of checkout customisation to extensions.- Each app can register up to 50 tags per store. Your app only sees and changes its own tags. The merchant can see and remove every tag on their store.
- Timing: a new or deleted tag reaches live pages within about 5 minutes (the storefront config cache). Nothing is baked into the theme.
- Uninstall: when the merchant uninstalls your app, its tags stop loading immediately and are deleted. They also stop loading while an install is waiting for the merchant to re-approve scopes.
- The script is loaded with
asyncand getsdata-dtc-script-tagon its element. Read the store withdocument.currentScriptor your own query string, e.g.?shop=<store_id>.