> 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`).
> - 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: Load Site Scripts on a Self-Managed Project

## Article: Load Site Scripts on a Self-Managed Project

## Article Link: https://dev.wix.com/docs/go-headless/self-managed-headless/site-scripts/load-site-scripts-on-a-self-managed-project.md

## Article Content:

# Load Site Scripts on a Self-Managed Project

Load the scripts a Wix project provides in a [self-managed headless](https://dev.wix.com/docs/go-headless/self-managed-headless/about-self-managed-headless.md) project. 1 script tag adds Wix Analytics page views, the project's cookie consent policy, the favicon, SEO tags from the dashboard, and custom code marked Essential. It works on any domain and with any framework, and it doesn't need backend code.

[Wix's Astro integration](https://dev.wix.com/docs/go-headless/wix-managed-headless/full-integration-astro/about-the-astro-integration.md) and a [static site you upload to Wix](https://dev.wix.com/docs/go-headless/wix-managed-headless/other-frameworks/your-own-frontend/upload-a-static-site.md) already include this tag.

To load the scripts:

1. Copy the project's client ID.

   In the project dashboard, go to **Settings** > **Development & integrations** > [**Headless Settings**](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Foauth-apps-settings), and copy the **Client ID** under **Headless clients**.

   In a project that has a `wix.config.json` file, the `appId` value is the client ID. A client you create later in Headless Settings works the same as the client Wix created with the project. See [Set Up a Headless Client](https://dev.wix.com/docs/go-headless/authentication/setup/set-up-a-headless-client.md).

2. Add this tag to the `<head>` of every page, and replace `YOUR_CLIENT_ID` with the client ID.

   In a framework, add the tag once, in the root layout or HTML template.

   ```html
   <script id="wix-site-script" src="https://manage.wix.com/_api/headless-business-setup/v1/headless-business/site-script.js" data-client-id="YOUR_CLIENT_ID" async></script>
   ```

   Keep the tag's `src`. The tag reads the client ID from `data-client-id`, and Wix serves the current script from that URL. Pasting the script's contents into the page doesn't pick up later changes. Wix ignores a second copy of the tag on the same page.

3. Open a page and inspect `<head>` in the browser's developer tools.

   Tags that Wix added have `wix-seo-tag="true"`. If none appear, check the console for a warning.

## What the script adds

| What | Details |
| --- | --- |
| Page views | Visits and page views in Wix Analytics, including when the visitor moves to another path with client-side routing. This doesn't include event tracking with `trackEvent()`, which is available with the Astro integration only |
| Cookie consent | The project's consent policy, applied to the other scripts this tag loads |
| Favicon | The favicon set in the dashboard. If the project has no favicon, the script doesn't add an icon tag |
| SEO tags | Title, canonical link, Open Graph, Twitter, and structured data from the project's SEO settings, for the URL the page first loaded at |
| Custom code | Custom code from the dashboard marked Essential, plus Google Analytics and Google Tag Manager when they're connected, in consent mode |

## Tags your page already has

Wix keeps a `<title>`, `<meta>`, or `<link>` the page already has, and skips its own tag of the same kind. For example, an existing `<title>` or `<meta name="description">` stays, and an existing `<link rel="canonical">` stays. Wix can still add a different tag, such as `og:title`, when the page doesn't have that one.

The script adds SEO tags in the browser, for the URL the page first loaded at. The tags don't change on client-side route changes. Crawlers that don't run JavaScript don't see them. To control the tags search engines read, render them on your server. See [About SEO for Self-Managed Headless Projects](https://dev.wix.com/docs/go-headless/self-managed-headless/seo/about-seo-for-self-managed-headless-projects.md).

Changes in the dashboard can take up to 10 minutes to show up on the site.

## Consent and stored data

The script stores an anonymous visitor token in `localStorage`, under the key `wixSiteScript:` followed by the client ID. Wix uses the token to recognize the visitor for analytics and for the scripts it loads. The token isn't an admin credential, and it isn't the headless client secret. The script doesn't set a cookie on your domain for that token.

The tag also loads the project's consent policy and applies it to analytics, custom code, and marketing tags. On a new project, that policy allows every category until a Wix user sets a stricter policy or a visitor makes a choice. A cookie banner appears only when the policy requires a banner. It doesn't appear under the default policy. For how that default works on a project built with the Astro integration, see [Manage Cookie Consent](https://dev.wix.com/docs/go-headless/wix-managed-headless/full-integration-astro/feature-guides/manage-cookie-consent.md).

## Content security policy

If the site sends a Content Security Policy, allow:

- Scripts from `manage.wix.com` and `static.parastorage.com`, and inline scripts. The tag injects inline scripts as well as files.
- Requests to `www.wixapis.com` and `frog.wix.com`. The script sends analytics page views to `frog.wix.com`.
- Images from `static.wixstatic.com`, when Wix hosts the favicon or a social image.

Google Analytics, Google Tag Manager, and other connected tags load from their own hosts. Allow those hosts too.

## See also

- [Set Up a Headless Client](https://dev.wix.com/docs/go-headless/authentication/setup/set-up-a-headless-client.md)
- [About SEO for Self-Managed Headless Projects](https://dev.wix.com/docs/go-headless/self-managed-headless/seo/about-seo-for-self-managed-headless-projects.md)
- [Manage Cookie Consent](https://dev.wix.com/docs/go-headless/wix-managed-headless/full-integration-astro/feature-guides/manage-cookie-consent.md)
- [Track Analytics Events](https://dev.wix.com/docs/go-headless/wix-managed-headless/full-integration-astro/feature-guides/track-analytics-events.md)