# Install on Wix

> Add Reveata to a Wix site with Custom Code, serve it from your own subdomain, and credit Wix Stores sales to their visits.

Wix adds code through **Custom Code** in the site’s dashboard. It only runs on a published site with a connected domain, which needs a Wix premium plan.

Copy the snippet from your Reveata dashboard (it contains your website’s tracking id):

```html
<script
  defer
  data-website-id="ws_your_tracking_id"
  src="https://reveata.com/js/script.js"
></script>
```

## Add it to your site

1. In your site’s dashboard, open **Settings**, then **Custom Code** (in the **Development & integrations** section).
2. Select **+ Add Custom Code** and paste the snippet.
3. Name it `Reveata`. Under **Add Code to Pages** choose **All pages** and **Load code once**.
4. Under **Place Code in**, choose **Head**.
5. If Wix asks for a consent category, choose **Analytics**. Wix’s cookie banner then holds the script back until a visitor accepts analytics.
6. Select **Apply**. The code runs on your published site.

In Reveata, add the website with your connected domain. Your `.wixsite.com` address is another host: visits there are refused unless you add it under **Settings → General → Additional domains**.

Wix moves between pages without full page loads. With **Load code once**, the script follows those page changes, so every page view is counted.

## Serve it from your own subdomain

Wix can’t run proxy code, but the [managed proxy](https://reveata.com/docs/managed-proxy) needs none. Add one DNS record (for example `stats.example.com`). If your domain uses Wix’s name servers, add it in Wix under **Domains → Manage DNS records**. Then replace the snippet in **Custom Code** with the new one Reveata gives you.

## Revenue

**Wix Stores and other Wix checkouts.** Wix charges through Wix Payments or a provider you connect, such as Stripe. When Stripe is the provider, connect the same Stripe account in Reveata under **Settings → Payments** ([restricted key](https://reveata.com/docs/stripe-restricted-key) or [Connect with Stripe](https://reveata.com/docs/stripe-connect)), and check first that a recent order appears in your Stripe dashboard. Wix Payments isn’t a Stripe account you can connect, so those orders can’t be imported; send them from your own server with the [Payments API](https://reveata.com/docs/payments-api) if you have one.

**Credit orders to visits.** Wix creates the payment itself, so it carries no visitor id, and Wix page code (Velo) runs apart from the page, so it can’t call the script. Orders are credited by the buyer’s email instead: identify people where they give you their email on your site. Add a second Custom Code snippet on **All pages**, in **Body – end**:

```html
<script>
  document.addEventListener('submit', function (e) {
    var input = e.target.querySelector('input[type="email"]');
    var email = input && input.value.trim().toLowerCase();
    if (email && window.reveata) window.reveata('identify', { userId: email, email: email });
  });
</script>
```

A Stripe payment with the same email is then credited to that visitor’s visits, even if it arrives later. Forms Wix shows inside a frame are not seen by this code. Only identify people when your privacy policy covers it: see [Identify visitors](https://reveata.com/docs/identify-visitors).

**Links to Stripe Payment Links** on your pages are credited with no code. See [Stripe Payment Links and buy buttons](https://reveata.com/docs/stripe-payment-links).


## Check it works

1. Open your published site in a normal browser window, accept analytics in the cookie banner if there is one, and turn ad blockers off for it.
2. Open **Realtime** in Reveata: your visit appears within a few seconds.
3. If nothing arrives, follow [Verify your installation](https://reveata.com/docs/verify-your-installation).

## Goals

Wix doesn’t let you add attributes to its own buttons. Use **Goals → Add goals → Page visit, no code** in Reveata with the path of a page people reach after the action (for example `/thank-you-page` for a purchase). See [Custom goals](https://reveata.com/docs/custom-goals).

## Common pitfalls

- **The settings disappear from the tag.** If the page source shows the script without its `data-website-id`, use this form, which puts the settings in the script address:

```html
<script defer src="https://reveata.com/js/script.js?website-id=ws_your_tracking_id"></script>
```

- **No connected domain or premium plan.** Wix doesn’t run custom code without them.
- **Changing your primary domain.** Wix removes custom code snippets when the primary domain changes. Add the snippet again afterwards.
- **The cookie banner.** With the **Analytics** category, visits only count after people accept. [Cookieless mode](https://reveata.com/docs/privacy-and-cookies) needs no cookies.
- **Testing on `.wixsite.com`** or in the editor preview. Test on your connected domain.
