Add a third-party script to a page
add_scriptAttach a third-party script to a page, either by URL or as inline code. Use this for analytics, pixels, chat widgets and similar integrations rather than editing the page HTML, so the script survives page edits. Scripts are injected when the page is next saved in the editor or published; the change is not live on an already-published page until then.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | URL of an external script to load. Give either this or code, not both. | |
| code | No | Inline JavaScript to embed. Give either this or url, not both. Paste the code itself; a wrapping <script> tag is unwrapped. Limit 64000 characters — host anything larger at a URL and use url instead. | |
| label | Yes | What this script is, for the dashboard, e.g. "Meta Pixel". Not shown to visitors. | |
| pageId | Yes | The page to act on (id from list_pages / list_sites). | |
| enabled | No | Whether the script is active. Defaults to true. | |
| placement | No | Where it goes: "head" for anything that must run before the page renders (most analytics), "body" for everything else, just before </body>. Defaults to "body". |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note | Yes | States when the script actually reaches the live page. | |
| count | Yes | Scripts on the page after this one. | |
| pageId | Yes | ||
| script | Yes | ||
| verified | Yes | False when the write reported success but the confirming read did not match. The change is probably saved; re-read with list_scripts to be sure. |