Privacy and Ethical Web Analytics
Tags: privacy, analytics, webdev, security
Published: 2020-10-20 16:34:45

---
title: Privacy and Ethical Web Analytics
published: true
date: 2020-10-20 00:00:00 UTC
tags: privacy,analytics,webdev,security
canonical_url: https://requestmetrics.com/web-performance/ethical-privacy-web-analytics
cover_image: https://requestmetrics.com/assets/images/webperf/privacy/privacy-title-1000.min.png
---

Web analytics is often based on invasively collecting and aggregating user data. But web analytics doesn’t have to be an invasion of privacy. A growing movement of businesses, including performance monitoring services like Request Metrics, are working to create sustainable web analytics tools. Tools that give web developers the metrics they need to improve their websites without compromising the privacy of our users.


Google is often the worst offender of user privacy. Through their useful _free_ analytics service (GA), they gather private user data from millions of websites. With all this data, they can predict your age, gender, education, wealth, and political affiliations.

> If one would give me [six websites visited] by the most honest [person], I would find something in them to have [them] hanged.
> 
> <cite>Cardinal Richelieu, updated for the information era</cite>

Users expect and [deserve some sense of privacy online](https://www.schneier.com/blog/archives/2006/05/the_value_of_pr.html). Unfortunately, the end-user tools to protect your privacy online are over-zealous, complicated, or poorly adopted. **As web developers, it’s our ethical responsibility to fulfill our user’s expectations of privacy, and we are accountable when it’s lost.**

## Privacy-Aware Web Analytics

Web analytics tools, including [web performance](https://requestmetrics.com/) and [error monitoring services](https://trackjs.com/), are critical for building great web applications. Together, they enable developers to build fast and reliable user experiences that are valuable to users.

In general, web analytics are trying to answer three questions:

1. How did the user find my website?
2. What is the user doing on my website?
3. What experience did the user have on my website?

**We can answer all of these questions AND maintain user privacy** by following three principles.

### 1. Limit Data Collection

What questions do you want to ask about your users, and what data do you need to answer them? By limiting the data you gather from the user, you ensure they will remain more private and more anonymous. Questions like:

- How often is my pricing page visited?
- How many users complete this form?
- What are the most common screen sizes used on my site?

There are only a few data points we would need to answer these questions, and users would understand our need to know this.

But data collection also includes the _scope_ of collection—mostly we only care what users do on _our_ website. But by using “free” third-party tools, you inadvertently broaden the scope of data to millions of sites.

### 2. Avoid Implicit User Identification

If the user hasn’t identified themselves, we shouldn’t attempt to do so either. This seems obvious and most people would find it “creepy”. Yet this is very common in many web analytics tools.

For some web applications, we know who the user is. They have logged in or provided an email address. They have explicitly identified themselves, and it’s okay to link their actions together.

But anonymous users expect to remain so. Technologies like **device fingerprinting** , **tracking cookies** , and **third-party iframes** implicitly identify the user using the volumes of data being collected about them.

Many governments are trying to address this problem through legislation like the [European GDPR](https://gdpr.eu/) and [Californian CCPA](https://oag.ca.gov/privacy/ccpa), but it is still common practice today.

### 3. Aggregate Data When Possible

Most of the questions we have about our users on public websites are not about _specific_ users, but rather aggregates of users:

- “_How many_ users visited my checkout page yesterday?”
- “_How many_ times has this video been watched?”
- “_How many_ times are mobile users visiting my site?”

We can answer these questions by aggregating a count of events rather than specific events on a user. Counting the number of visitors to a page in this hour, like old-school web counters did, we can answer many of our questions without compromising user privacy at all.

Of course, this doesn’t work for every case. We have a lot of questions about usage in the Request Metrics application where we need to know both _who_ and _what_ happened specifically.

## Supporting a Fast and Private Web

Of course, the big players like Google and Facebook don’t play by these rules. The “free” services they provide are built on the value of taking user data and tracking them around the web using **third-party cookies**. When developers include JavaScript from them, they are sacrificing some end user privacy for convenience.

At Request Metrics, we didn’t think it was a good trade for our users or _their_ visitors. All our performance monitoring data is kept in our own system, aggregated and non-identifiable. We have no idea who your users are or where they will go next—we just know how fast your site was for them.

We also built an internal product analytics system using Elastic to keep our important user usage and engagement data private. We hope to adapt it for anonymous web analytics and put it on this static website as well.

* * *

There is no perfect solution, and there are valid reasons to use Facebook’s SDK or Google Analytics. But as developers, we should also consider ways to send less data to third parties. Maybe by using plain-old links to social networks instead of their widgets. Or maybe not including Google Analytics and opting for a commercial option instead.