> ## Documentation Index
> Fetch the complete documentation index at: https://docs.molin.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Widget script

> Add the Molin AI widget script to every page of your site once, so the Personalization, Show/Hide and Tracking JavaScript APIs can use it.

If you embed Molin AI yourself, add this script to the `<head>` of **every page**, once. The JavaScript APIs in this section only work on pages where it runs.

```html theme={null}
<script defer src="https://widget.molin.ai/shop-ai.js?w=YOUR_WIDGET_ID"></script>
```

Replace `YOUR_WIDGET_ID` with your widget ID, which you find on the [Publish](https://molin.ai/app/publish) page of your dashboard.

<Warning>
  Add the script directly to your site's HTML. We don't recommend [Google Tag Manager](/home/general/google-tag-manager) or similar tools, because ad blockers often block them, and the widget then
  doesn't load for those visitors.
</Warning>

<Note>If your shop runs on Shopify, Shoprenter, UNAS or Shoper, our app already adds the script. Do not add it again.</Note>

## Load it only once

If the script is on a page twice, the second copy is ignored and the browser console shows `[Molin] the widget script is embedded more than once, ignoring the duplicate`. Remove the extra copy, for example one added by both your theme and Google Tag Manager.

## When `window.Molin` is ready

The script loads after the rest of your page, as described in [Loading behavior](/home/general/loading-behavior). `window.Molin` only exists from then on, and the [`molin:ready`](/home/marketing/javascript-events#molinready) event fires on `window` when it does.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.