> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Add an Embedded Script Extension

## Article: Add an Embedded Script Extension in Studio Two

## Article Link: https://dev.wix.com/docs/studio-two/code-your-site/build-a-custom-frontend/embedded-scripts/add-an-embedded-script-extension.md

## Article Content:

# Add an Embedded Script Extension in Studio Two

An [embedded script](https://dev.wix.com/docs/studio-two/code-your-site/build-a-custom-frontend/embedded-scripts/about-embedded-scripts.md) is an HTML or JavaScript fragment that loads in the site page head or body.

Follow the instructions below to:

1. Add an embedded script extension to your site project.
2. Customize the script.
3. Publish your site.
4. Load the script and check it.

> **Note:** You can also ask **Aria**, Wix's AI assistant, to create and customize the extension.

## Step 1 | Add an embedded script

To add an embedded script:

1. In the Studio Two editor, open the **Code** tab.
2. In the VS Code sidebar, open the **Wix Extension Builder**.

   ![the Wix Extension Builder in the VS Code activity bar](https://wixmp-833713b177cebf373f611808.wixmp.com/images/6bff2816a5bfe47ed855a1859cd89d5a.png)

3. Under **Create an Extension**, choose **Site**, then **Embedded Script**.
4. Fill in the form:
   - **Script type**: The consent category. Choose **Essential**, **Functional**, **Analytics**, or **Advertising**.
   - **Placement**: Where in the page HTML the script is injected. Choose **Head**, **Body Start**, or **Body End**.
   - **Name**: The display name for the script. The Wix Extension Builder also uses it as the folder and file name. For example, `My Script` becomes the folder `my-script`. In this article, `<script-folder>` stands for that folder name.
5. Click **Generate**.

You can find the new files under `src/extensions/site/embedded-scripts/<script-folder>/`. The extension is registered in your project's `extensions.ts` and listed under **My Extensions**. For what each file is for, see [Embedded Script Extension Files and Code](https://dev.wix.com/docs/site-extensions/embedded-scripts/embedded-script-extension-files-and-code.md).

## Step 2 | Customize your embedded script

You can edit the generated files to match the script behavior you need. When you're happy with the script, move on to the next step.

For the full workflow, from the configuration file to dynamic parameters and a local script module, see [Build an Embedded Script in Studio Two](https://dev.wix.com/docs/studio-two/code-your-site/build-a-custom-frontend/embedded-scripts/build-an-embedded-script-in-studio-two.md).

For example, to update the script content:

1. Open `<script-folder>.html`.
2. Replace `console.log('Hello {{name}}');` with `console.log('Hello world!');`.
3. Save the file.

When the script runs on the site, the browser console logs **Hello world!**.

## Step 3 | Publish your site

When you're ready, click **Publish** in the Studio Two editor. Publishing ships the script, but it doesn't load it on the site.

## Step 4 | Load the script and check it

The script loads on your site only after your code calls [Embed Script](https://dev.wix.com/docs/api-reference/app-management/embedded-scripts/embed-script.md), for example from a button on a dashboard page. To add that code and check the script on the live site, follow Steps 4 and 5 of [Build an Embedded Script in Studio Two](https://dev.wix.com/docs/studio-two/code-your-site/build-a-custom-frontend/embedded-scripts/build-an-embedded-script-in-studio-two.md).

## See also

- [About Embedded Scripts](https://dev.wix.com/docs/studio-two/code-your-site/build-a-custom-frontend/embedded-scripts/about-embedded-scripts.md)
- [Build an Embedded Script in Studio Two](https://dev.wix.com/docs/studio-two/code-your-site/build-a-custom-frontend/embedded-scripts/build-an-embedded-script-in-studio-two.md)
- [Embedded Script Extension Files and Code](https://dev.wix.com/docs/site-extensions/embedded-scripts/embedded-script-extension-files-and-code.md)
- [About Studio Two Extensions](https://dev.wix.com/docs/studio-two/get-started/about-studio-two-extensions.md)
- [Embedded Scripts](https://dev.wix.com/docs/overview/extensions-framework/site-extensions/embedded-scripts.md)