An embedded script is an HTML code fragment injected into the DOM of a Wix site. Unlike other site extensions, it isn't placed by the Wix user in the editor. Once embedded, the script runs on the live site.
Use an embedded script when you need to inject a raw HTML or JavaScript fragment into the site rather than a placeable component. Common cases include:
Tip: For visible UI that Wix users position and configure visually inside a page's layout, use a site widget instead.
Unlike other site extensions, embedded scripts aren't fully configured when an app is installed. The app developer needs to provide an explicit step that injects the script onto the site, by calling the Embed Script API. The call can come from the app's backend, or from a dashboard page where the Wix user triggers it manually.
Each embedded script declares a script type that determines how it interacts with the site's cookie consent UI. The platform supports the following types, ordered from least to most restrictive:
ESSENTIAL: Core functionality the site can't work without, like authentication or security primitives. No consent required.FUNCTIONAL: Remembers visitor choices to improve the experience, like language or UI preferences. Consent required.ANALYTICS: Reports usage data, like Google Analytics, Hotjar, or Mixpanel. Consent required.ADVERTISING: Provides visitor data for marketing, like Facebook Pixel, Google Ads, or retargeting. Consent required.If a script falls into multiple types, use the most restrictive applicable type. For example, a script used for analytics and advertising should be declared as ADVERTISING.
A script can accept dynamic parameters that get filled in per installation, so the same script can carry per-app-instance configuration without code changes. The parameter values are supplied when the script is embedded.
Changing a script's parameter set requires Wix users who have the app installed to update the app to receive the new version.
Once embedded, a script's HTML fragment is injected into the site's DOM and runs on the published site. Script execution can happen before the DOM has fully loaded, so scripts that touch the DOM need to wait for it to be ready before running.
Embedded script code runs on the published site with the identity of the person viewing the page (a visitor or member), the same as other site extensions. Elevation isn't available in the browser; to call APIs that require Wix app authentication, route the work through a backend handler and elevate there. The Site API host module is only available to embedded scripts created with the Wix CLI.
Last updated: 2 August 2026