post https://{shopdomain}.myshoplaza.com/openapi/2022-01/script_tags_new
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:
- Adding custom JavaScript functionality to a shop's pages.
- Integrating third-party tracking scripts or widgets.
- Managing script tags programmatically for dynamic content.
Request Parameters
Public Request Parameters
Body Parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
src | string | Yes | Java Script file URL, must be valid and accessible. | https://www.shoplazza.com/x.js |
display_scope | string | Yes | Determines where the script is displayed. | index |
event_type | string | No | Tag type to identify the script usage. Defaults to app . | myapp |
Response Explanation
Public Response Parameters
Success Response
Field | Type | Description | Example |
---|---|---|---|
id | string | Unique identifier for the created script tag. | 202304240001 |
display_scope | string | Indicates where the script tag is applied. | all |
src | string | URL of the script file. | https://www.shoplazza.com/x.js |
event_type | string | The tag type, as specified during creation. | myapp |
created_at | string | The timestamp when the script tag was created. | 2024-04-24T07:26:53Z |
updated_at | string | The 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.
Field | Type | Example | Description |
---|---|---|---|
error | String | "page not found" | Indicates an error encountered during the process |
Error Detail
Status Code | Message | Possible Reason | Example Response | ||
---|---|---|---|---|---|
400 | Bad Request | Invalid input format or request structure (e.g., missing required fields or incorrect data types). | Bad Request | ||
Unauthorized | The request is missing valid authentication credentials or the credentials provided are invalid. | Unauthorized | |||
422 | Unprocessable Entity | "display_scope can't contain [all | checkout | thank_you]" |