Google Analytics has been deemed illegal by the EU DPA. Undicat is a British company, operated fully on European infrastructure.

Netlify Proxy

#You can use Netlify redirects to proxy all analytics traffic through your own domain. This will reduce DNS lookups, as well as prevent Adblockers from blocking requests.

1. Add rewrites to _redirects file

Add following rewrite rules into the file:

/analytics.js  https://cdn.undicat.com/analytics.js  200
/_catnip/*  https://api.undicat.com/:splat  200

Find the Netlify rewrites documentation here

2. Adapt the analytics config

You will need to adapt the script tag to reflect the changes and use your own proxy.

Using in html

<script async endpoint="/_catnip" src="/analytics.js"></script>

endpoint sets the endpoint for all tracking calls. We are using /_catnip in this example but feel free to use whatever you would like.

src needs to point to the Undicat Analytics JS file that is proxied through your servers. We are using /analytics.js in this example. Feel free to adapt those paths & filenames.

Using the JavaScript Library

When using the @undicat/analytics library, you can provide the custom endpoint and the URL to the proxied script in the init function.

undicat.init('ABCDEFGHI', {
  endpoint: "/_catnip",
})

All set. You can open up the network tab inside the DevTools to verify that all traffic is indeed routed through your domain.