Scripts
Creates, retrieves, updates, and deletes scripts injected into the storefront.
Table Specific Information
Select
The add-in uses the BigCommerce API to process WHERE clause conditions built with the following columns and operators:
- Uuid supports the = comparison.
- ChannelId supports the = and IN comparisons.
- Name, Description, DateCreated, DateModified supports sorting on server side.
The rest of the filter is executed client-side within the add-in.
For example, the following queries are processed server-side:
SELECT * FROM Scripts WHERE Uuid = '4a4a4a4a-0000-0000-0000-000000000000'
SELECT * FROM Scripts WHERE ChannelId = 1
Insert
To insert a script, specify the Name column along with either Src or Html, but not both.
INSERT INTO Scripts (Name, Src, Location, Visibility) VALUES ('Analytics', 'https://cdn.example.com/analytics.js', 'head', 'storefront')
Update
Only scripts created by the same API account can be retrieved, updated, or deleted; scripts added through the Script Manager in the control panel are not accessible through this API.
UPDATE Scripts SET Enabled = false WHERE Uuid = '4a4a4a4a-0000-0000-0000-000000000000'
Delete
DELETE FROM Scripts WHERE Uuid = '4a4a4a4a-0000-0000-0000-000000000000'
Columns
| Name | Type | ReadOnly | Description |
| Uuid [KEY] | String | True |
The unique identifier of the script. |
| Name | String | False |
The name of the script. |
| Description | String | False |
A description of the script. |
| Kind | String | True |
Whether the script is a source-linked script or an inline script tag. The allowed values are src, script_tag. |
| Src | String | False |
The URL to load the script from. Specify either Src or Html, not both. |
| Html | String | False |
The literal script tag markup to inject. Specify either Src or Html, not both. |
| LoadMethod | String | False |
How the script is loaded when Src is specified. The allowed values are default, async, defer. |
| Location | String | False |
Where on the page the script is injected. The allowed values are head, footer. |
| Visibility | String | False |
Which pages the script is injected into. The allowed values are storefront, checkout, all_pages, order_confirmation. |
| Enabled | Boolean | False |
Whether the script is enabled. |
| AutoUninstall | Boolean | False |
Whether the script is automatically removed when the app that created it is uninstalled. |
| ConsentCategory | String | False |
The cookie consent category the script belongs to. The allowed values are essential, functional, analytics, targeting. |
| IntegrityHashes | String | False |
A JSON-formatted array of up to 5 Subresource Integrity hashes for a source-linked script. |
| ApiClientId | String | True |
The Id of the API account that created the script. |
| ChannelId | Integer | False |
The Id of the channel this script is associated with. |
| DateCreated | Datetime | True |
Date and time the script was created. |
| DateModified | Datetime | True |
Date and time the script was last modified. |