# Add Privatus Analytics to Squarespace

> Add cookieless analytics to Squarespace with header code injection, and track purchases with revenue from the Order Status Page without sending order details.

Code injection needs a Squarespace plan that includes it.

1. Go to **Settings → Advanced → Code Injection** (or **Website → Pages →
   Custom code → Code injection**).
2. Paste the snippet into **Header**:

   ```html
   <script defer src="https://privatusanalytics.com/js/pa.js" data-site="pa_YOURSITEID" data-modules="engage,auto,vitals,clicks"></script>
   ```

3. Save.

Squarespace 7.1 loads pages with full navigations, so the default settings
work. If you use AJAX page loading on a 7.0 template, the tracker still
follows `history.pushState` navigations (`data-spa="auto"`).

## Order confirmation

Under **Code Injection → Order Status Page**, Squarespace can run a script
after a purchase. The tracker from the header is already on that page, so
you only need the event:

```html
<script>
  window.addEventListener('load', function () {
    privatus.track('purchase', { revenue: {orderGrandTotal}, currency: 'USD' });
  });
</script>
```

`revenue` and `currency` are read as the event's revenue. Set `currency`
to your store's currency. Replace the variable with the one your order
page offers, and never send order numbers or customer details.
