Docs
Browse the docs

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.

View as Markdown

Code injection needs a Squarespace plan that includes it (Core and above on current plans).

  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"></script>
  1. 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>

Replace the variable with the one your plan's order page offers, and never send order numbers or customer details.