Create Script Tag

🔒

Requires write_script_tags access scope. More refer access scope

The Create Script Tag API allows developers to create and inject JavaScript tags into a shop's storefront pages. This functionality enables the addition of external scripts for various purposes, such as analytics, custom features, or third-party integrations.

This API is especially useful for:

  1. Adding custom JavaScript functionality to a shop's pages.
  2. Integrating third-party tracking scripts or widgets.
  3. Managing script tags programmatically for dynamic content.

Request Parameters

Public Request Parameters

📘

Public Request Parameters

Body Parameters

ParameterTypeRequiredDescriptionExample
srcstringYesJava Script file URL, must be valid and accessible.https://www.shoplazza.com/x.js
display_scopestringYesDetermines where the script is displayed.index
event_typestringNoTag type to identify the script usage. Defaults to app.myapp

Response Explanation

Public Response Parameters

📘

Public Response Parameters

Success Response

FieldTypeDescriptionExample
idstringUnique identifier for the created script tag.202304240001
display_scopestringIndicates where the script tag is applied.all
srcstringURL of the script file.https://www.shoplazza.com/x.js
event_typestringThe tag type, as specified during creation.myapp
created_atstringThe timestamp when the script tag was created.2024-04-24T07:26:53Z
updated_atstringThe timestamp when the script tag was last updated.2024-04-24T07:26:53Z

Error Response

Error responses in the API can be represented using two different fields: errors and error. Both fields provide details about issues encountered during request processing. Below is an explanation of the fields with their respective examples and descriptions.

FieldTypeExampleDescription
errorString "page not found"Indicates an error encountered during the process

Error Detail

Status CodeMessagePossible ReasonExample Response
400Bad RequestInvalid input format or request structure (e.g., missing required fields or incorrect data types).Bad Request
UnauthorizedThe request is missing valid authentication credentials or the credentials provided are invalid.Unauthorized
422Unprocessable Entity"display_scope can't contain [allcheckoutthank_you]"

API Structure Overview

Language
Credentials
Header
URL
Click Try It! to start a request and see the response here!