How to Bypass Adblockers for Umami/Plausible Analytics Using Reverse Proxy

How to Bypass Adblockers for Umami/Plausible Analytics Using Reverse Proxy

In an era where privacy is paramount, many website owners are turning to privacy-first analytics solutions to respect their users' data. However, these analytics tools often end up on blocklists, hindering accurate data collection.

To address this challenge, we'll explore how to set up a reverse proxy with Caddy (You can use any webserver you want), allowing privacy-first analytics tools to bypass adblockers and provide valuable insights while maintaining user privacy. We'll use Umami Analytics as an example.

💡
Umami is a simple, fast, privacy-focused, open-source analytics solution. It's a better alternative to Google Analytics because it gives you total control of your data and does not violate the privacy of your users.

Prerequisites:

Before diving in, ensure you have access to a server where Caddy can be installed, and a basic understanding of web server configuration.

You can install caddy by following this guide.

Configuration:

With Caddy installed, it's time to configure it for Umami Analytics. Open your Caddyfile configuration and add the following lines to set up the reverse proxy for Umami's analytics script:

your.domain.com {
    reverse_proxy /script.js https://analytics.eu.umami.is {
        header_up Host "analytics.eu.umami.is"
    }
}
💡
Consider using a subdomain/domain that avoids terms like "tracking" or "analytics." For instance, you could opt for t.yourdomain.com

Testing:

After saving the changes to the Caddyfile, restart Caddy to apply the new configuration. Then visit your.domain.com/script.js to see if the js file is being loaded.

Deployment:

If testing is successful, you're ready to add the code analytics code to your website.

First replace analytics.eu.umami.is with your domain in the code snippet provided by Umami and add the code to your website:

<script defer src="https://your.domain.com/script.js" data-website-id="<website-id-redacted>"></script>

Then visit your website and check Umami Dashboard. You should see updated analytics.

Umami Dashboard

Summary:

Configuring a reverse proxy with Caddy or other web servers for third-party analytics services like Umami presents a robust solution for bypassing adblockers while upholding user privacy. While many privacy-first analytics services offer self-hosting options, enabling website owners to maintain control over their data and ensure compliance with privacy regulations, this approach isn't always feasible for every user due to technical complexities, ongoing server maintenance, and potential security risks. By leveraging reverse proxy, website owners can strike a balance between data ownership, privacy, and implementation simplicity, enabling them to harness the benefits of first-party analytics without the overhead of self-hosting. This middle ground empowers website owners to make informed decisions and optimize their online presence effectively.