An embedded script is a configuration file plus an HTML fragment. You generate the files first, then spend most of your time in the HTML file.
This article walks through that loop from a scaffolded script to one that logs a message and can carry a per-installation value.
Follow the instructions below to:
Start from a generated embedded script rather than an empty folder, so the file structure and registration are already in place.
For the full procedure, see Add an Embedded Script Extension in Studio Two.
You can find the new files under src/extensions/site/embedded-scripts/<script-folder>/. You spend most of this article in <script-folder>.html. For what every file in the folder is for, see Embedded Script Extension Files and Code.
<script-folder>.extension.ts is the configuration file you own. It declares the script ID, name, placement, script type, and path to the HTML file.
Keep id stable once other code depends on it. When an app has more than one embedded script, this value is the component ID you pass to the Embed Script API.
placement is HEAD, BODY_START, or BODY_END. scriptType is ESSENTIAL, FUNCTIONAL, ANALYTICS, or ADVERTISING. Those values match the Placement and Script type choices from Generate.
For every field, see Embedded Script Extension Files and Code.
<script-folder>.html is the fragment injected into the page at the placement you set. A generated script logs a greeting and loads a local module:
{{name}} is a dynamic parameter. The platform replaces it when the script is embedded. The placeholder has to sit inside quotes, and the name has to match the name you pass to the Embed Script API.
logger.ts is a generated module in the same folder. The HTML loads it with type="module". You can replace the module, or delete that script tag if the fragment doesn't need a separate file.
For example, to log a fixed message instead of a parameter:
<script-folder>.html.console.log('Hello {{name}}'); with console.log('Hello world!');.When the script runs on the site, the browser console logs Hello world!.
To check the script on the published site, follow Add an Embedded Script Extension in Studio Two.
When the script behaves the way you want, click Publish in the Studio Two editor to ship it with your site.
Last updated: 2 November 2026