scriptTagCreate mutation
Creates a new script tag.
Required access
write_script_tags access scope.
On this page
Interactive example
This is an example mutation query. Use the embedded interactive tool below to edit the query.
Hint: use Ctrl + Space for autocompleting fields.
mutation scriptTagCreate($input: ScriptTagInput!) { scriptTagCreate(input: $input) {} } { “input”: {} }
<font style="color:#1F61A0;">scriptTag</font> <font style="color:#555555;">{</font><font style="color:#1F61A0;">id</font><font style="color:#555555;">}</font><font style="color:#1F61A0;">userErrors</font> <font style="color:#555555;">{</font><font style="color:#1F61A0;">field</font><font style="color:#1F61A0;">message</font><font style="color:#555555;">}</font>
Arguments
| Argument | Description |
|---|---|
input( [ScriptTagInput!](https://shopify.dev/docs/admin-api/graphql/reference/online-store/scripttaginput)) REQUIRED |
Specifies the input fields for a script tag. |
ScriptTagInput fields
- displayScope (
[ScriptTagDisplayScope](https://shopify.dev/docs/admin-api/graphql/reference/online-store/scripttagdisplayscope))
The page or pages on the online store where the script should be included. - src (
[URL](https://shopify.dev/docs/admin-api/graphql/reference/scalar#url-2021-01))
The URL of the remote script.
Return fields
- scriptTag (
[ScriptTag](https://shopify.dev/docs/admin-api/graphql/reference/online-store/scripttag))
The script tag that was created. - userErrors (
[[UserError!]!](https://shopify.dev/docs/admin-api/graphql/reference/usererror))
List of errors that occurred executing the mutation.
