scriptTag
Theme app extensions
Your app might not pass App Store review if it uses script tags instead of theme app extensions. All new apps, and apps that integrate with Online Store 2.0 themes, should use theme app extensions, such as app blocks or app embed blocks. Script tags are an alternative you can use with only vintage themes. Learn more.
Script tag deprecation
Script tags will be sunset for the Order status page on August 28, 2025. Upgrade to Checkout Extensibility before this date. Shopify Scripts will continue to work alongside Checkout Extensibility until August 28, 2025.
Lookup a script tag resource by ID.
Anchor to Possible returnsPossible returns
- Anchor to ScriptTagScript•
Tag Theme app extensions
Your app might not pass App Store review if it uses script tags instead of theme app extensions. All new apps, and apps that integrate with Online Store 2.0 themes, should use theme app extensions, such as app blocks or app embed blocks. Script tags are an alternative you can use with only vintage themes. Learn more.
Script tag deprecation
Script tags will be sunset for the Order status page on August 28, 2025. Upgrade to Checkout Extensibility before this date. Shopify Scripts will continue to work alongside Checkout Extensibility until August 28, 2025.
A script tag represents remote JavaScript code that is loaded into the pages of a shop's storefront or the Order status page of checkout.
- cache•Boolean!non-null
Whether the Shopify CDN can cache and serve the script tag. If
true
, then the script will be cached and served by the CDN. The cache expires 15 minutes after the script tag is successfully returned. Iffalse
, then the script will be served as is.- created
At •Datenon-nullTime! The date and time when the script tag was created.
- display
Scope •Scriptnon-nullTag Display Scope! The page or pages on the online store that the script should be included.
- id•ID!non-null
A globally-unique ID.
- legacy
Resource •Id Unsignednon-nullInt64! The ID of the corresponding resource in the REST Admin API.
- src•URL!non-null
The URL to the remote script.
- updated
At •Datenon-nullTime! The date and time when the script tag was last updated.
- cache•
Retrieves a single script tag
query GetScriptTag($id: ID!) {
scriptTag(id: $id) {
id
cache
createdAt
displayScope
src
updatedAt
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/unstable/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "query GetScriptTag($id: ID!) { scriptTag(id: $id) { id cache createdAt displayScope src updatedAt } }",
"variables": {
"id": "gid://shopify/ScriptTag/466217408"
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query GetScriptTag($id: ID!) {
scriptTag(id: $id) {
id
cache
createdAt
displayScope
src
updatedAt
}
}`,
{
variables: {
"id": "gid://shopify/ScriptTag/466217408"
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `query GetScriptTag($id: ID!) {
scriptTag(id: $id) {
id
cache
createdAt
displayScope
src
updatedAt
}
}`,
"variables": {
"id": "gid://shopify/ScriptTag/466217408"
},
},
});
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~QUERY
query GetScriptTag($id: ID!) {
scriptTag(id: $id) {
id
cache
createdAt
displayScope
src
updatedAt
}
}
QUERY
variables = {
"id": "gid://shopify/ScriptTag/466217408"
}
response = client.query(query: query, variables: variables)