Skip to content
Privatus-AnalyticsPublic

About

Privatus Analytics app for Swell: cookieless store analytics with order revenue sent from the browser

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Privatus Analytics for Swell

See which visits turn into sales in your Swell store. No cookies, no cookie pop-up, no bots.

You want to know where your buyers come from. But Google Analytics uses cookies, so in many countries you must show a cookie pop-up first (the box that asks visitors to say yes to cookies). Many people click no, so their visits and their orders never show up in your numbers. Bots add fake visits on top.

This Swell app adds Privatus Analytics to your store. It loads a small tracking script on your storefront, and it can send each placed order as a Purchase event with its total and currency. The script sets no cookies and keeps no IP addresses. Bots are filtered out before they are counted.

So you see how many real people came, where they came from, and how much they spent, on one simple dashboard.

Free plan, no card: 10,000 events a month (an event is a page view or an action you track) on up to 3 sites. Start free at privatusanalytics.com.

  • No cookies. No cookies and no hidden IDs on your shoppers' devices, and no IP addresses are kept. Laws differ by country, so check your own legal advice.
  • Real people, not bots. Known bots, data centers and spam visits are left out on every plan.
  • Nothing sent from a server. Visits and orders are only sent by the script in the shopper's browser. The app never sends your store data to Privatus Analytics.

What is in this app

Part What it does
settings/privatus.json A settings page in your Swell dashboard: site ID, send placed orders, which total to use, and the event name.
functions/config.ts A public, read-only function that gives your storefront the site ID and tracker options from those settings.
storefront/privatus-swell.js A small script for your storefront. It loads the tracker and sends a placed order once.

Set up

1. Get your site ID

Make a free account at privatusanalytics.com and add your store. Copy the site ID. It starts with pa_.

2. Install the app

Install Privatus Analytics from the Swell App Store. Open the app in your Swell dashboard and paste your site ID.

3. Add the script to your storefront

Put this line in the <head> of every page. In a Proxima theme such as Sunrise, that is layout/theme.liquid. In a headless storefront, add it to your main layout.

<script defer src="https://cdn.jsdelivr.net/gh/Privatus-Analytics/swell@1/storefront/privatus-swell.js" data-site="pa_YOURSITEID"></script>

Or let the script read the site ID and your choices from the app settings:

<script defer src="https://cdn.jsdelivr.net/gh/Privatus-Analytics/swell@1/storefront/privatus-swell.js" data-config="https://YOUR-STORE-ID.swell.store/functions/privatus_analytics/config"></script>

You can also host storefront/privatus-swell.js yourself.

4. Send placed orders

On your order confirmation page, load the order the way you already do, then pass it to the script:

const order = await swell.cart.getOrder(checkoutId)
PrivatusSwell.trackOrder(order)

This calls privatus.track('Purchase', { revenue: 54.99, currency: 'USD', items: 2 }). It reads grand_total (or sub_total if you picked it), currency and item_quantity. No names, emails, addresses or order numbers are sent. The same order is sent only once per page load. It is safe to call before the tracker has loaded, because calls wait in a queue.

5. Count revenue in your dashboard

In Privatus Analytics, add a goal for the custom event Purchase and set its value to Event revenue. See revenue tracking.

Privacy

The tracker sets no cookies and uses no device IDs. See the privacy documentation for what is collected.

If you have a privacy policy, it should say which tools handle your visitors' data. You can paste this:

This website uses Privatus Analytics to count visits. It does not use cookies and does not follow you from one website to another. Your IP address is used for a moment to count visits and is never stored.

Change it to fit your store.

Development

npm install
npm run check   # syntax check the storefront script and the JSON config
npm test        # settings, config function and storefront script tests

Release with the Swell CLI: swell app push, then swell app release <version> --release-notes CHANGELOG.md.

MIT licensed. See LICENSE.

About

Privatus Analytics app for Swell: cookieless store analytics with order revenue sent from the browser

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages