# Install on Wix

> Add MetricRaven to every page of a Wix site with Custom Code.

Source: https://metricraven.com/docs/install-wix  
Markdown: https://metricraven.com/docs/install-wix.md  
Section: Installation guides

Wix's Custom Code setting adds the tag to the head of every page. It works on a published site with a connected domain, which needs a Wix premium plan.

1. **Open Settings → Custom Code**

   In your site dashboard, open **Settings** and choose **Custom Code** (under Development & integrations).

2. **Add Custom Code**

   Choose **+ Add Custom Code** and paste the snippet. Replace `YOUR_SITE_ID` with the public site ID from your site's **Settings → Install** card. The site ID is public and safe in browser code; never put your secret key in a page.

   ```html title="Custom Code"
   <script
     defer
     src="https://metricraven.com/js/script.js"
     data-site-id="YOUR_SITE_ID"
   ></script>
   ```

3. **Choose where it loads**

   Name it MetricRaven, apply it to **All pages**, choose **Load code once**, and set **Place Code in** to **Head**. The tracker records later page changes itself. Then choose **Apply**.

4. **Open your site on its connected domain**

   Check a page in a private window, not the editor preview.

> **Verify it works**
>
> Open your live website in a normal browser window (not an automated or embedded one). In the browser's Network panel, look for `script.js` and then a request to `/api/v1/collect` whose response contains `ok: true`. Open your site's **Traffic** tab and choose **Refresh**; the selected dates must include your visit.
>
> Nothing showing? See [Troubleshooting](https://metricraven.com/docs/troubleshooting).

## Notes

- Custom code belongs to your site's domain. If you change the primary domain, check the snippet is still listed.
- Use the site-wide head code setting, not an embed or HTML widget: widgets that place code inside an iframe are ignored by the tracker.
- Only hostnames listed in your site's **Settings → General → Site** domains (and their subdomains) are accepted. To also count visits on a platform address such as `your-site.wixsite.com`, add it there; otherwise those requests are refused with `domain_not_allowed`.
- The editor and its previews load pages inside a frame, which the tracker ignores.
- If you use a cookie banner, connect it with [Consent & visitor IDs](https://metricraven.com/docs/consent).

Optional script attributes are listed in [Install & verify](https://metricraven.com/docs/install). To exclude your own visits, see [Exclude your visits](https://metricraven.com/docs/exclude-visits).
