# Privacy-first analytics: minimisation, consent and residency

Privacy-first analytics in practice: data minimisation, cookieless defaults, consent and residency, with guides to the GDPR, the CCPA and India’s DPDP Act.

Source: https://pug.sh/learn/privacy-first-analytics

Privacy-first analytics collects the events a question needs, stores no identifier on the device until there is a basis to, and keeps the data where you control it. This page covers those practices and links the guide for each law: the GDPR, the CCPA, and India’s DPDP Act.

By [Praveen Kumar](https://github.com/poluruprvn), who builds Pug. Updated November 21, 2026

## What privacy-first means

Privacy-first analytics is a set of choices that keep personal data to a minimum and keep you in control of it: capture only the events you need, avoid personal identifiers you will not use, store no identifier on the device without a basis, share nothing with ad networks, and keep the data somewhere you control. The goal is to answer your product questions with the least sensitive data that answers them.

> The most private event is the one you never needed to collect. Start from the questions you must answer, then capture only what those require.

## The guides, law by law

The practices on this page hold everywhere. What changes between jurisdictions is when you need consent, what counts as a sale, and what you owe people afterwards. Each law has its own guide:

- [GDPR compliance for analytics](https://pug.sh/learn/gdpr-analytics): the EU and EEA. A lawful basis before you process, ePrivacy consent before you touch the device, access and erasure requests, and transfers out of the EU.
- [CCPA compliance for analytics](https://pug.sh/learn/ccpa-analytics): California. Opt-out rather than opt-in, when an analytics vendor makes you a seller, and the Global Privacy Control signal you must honour.
- [The DPDP Act and your analytics](https://pug.sh/learn/dpdp-act-analytics): India. Consent first, no tracking of under-18s, and Rules notified in November 2025 that phase the duties in over 18 months.

Three more cover the techniques underneath:

- [Cookieless analytics, explained](https://pug.sh/learn/cookieless-analytics): the three ways to measure without device storage, and what a rotating identifier costs your metrics.
- [Cookieless tracking vs fingerprinting](https://pug.sh/learn/cookieless-vs-fingerprinting): why a stable fingerprint is treated like a cookie under ePrivacy Article 5(3).
- [Personally identifiable information](https://pug.sh/glossary/pii): which fields count, including IP addresses, device IDs and user IDs, and the free [PII event auditor](https://pug.sh/tools/pii-event-auditor) that flags them in an event schema.

## Cookies and consent

Much of analytics’ privacy reputation comes from third-party cookies used for cross-site tracking. Privacy-first tools avoid those: many web-analytics tools run cookieless, identifying sessions without persistent personal identifiers, which can reduce or remove the need for a consent banner depending on your jurisdiction. The [cookieless analytics tools roundup](https://pug.sh/learn/best-cookieless-analytics-tools) compares how each one derives its identifier and how often it rotates. Product analytics is usually assumed to be the exception, since tying events to a person is the point of it, but it does not have to start there. Pug’s Web SDK defaults to cookieless: events flow, no identifier is stored on the device, and events are tied to a person only once consent is granted. Past that point the privacy work is **data minimisation**: store only the traits you use, and say what you collect.

## Data residency and ownership

A large share of privacy-law friction is about **where data goes**. Sending event data to a third-party cloud, especially one outside your region, raises cross-border transfer questions under the GDPR and a vendor contract question under the CCPA. The cleanest way to avoid both is to keep the data on infrastructure you control. This is where [self-hosting](https://pug.sh/self-hosted-analytics) matters: when you run the analytics tool yourself, events are written to your own database, in a region you choose, under your own retention and access rules.

## A practical privacy-first checklist

- **Minimise:** capture only the events and traits you will use.
- **Default to cookieless:** store no identifier on the device until you have a basis to.
- **Avoid third-party sharing:** prefer tools that do not route data to ad networks.
- **Control residency:** self-host, or choose a region you are comfortable with.
- **Set retention:** keep data only as long as you need it, and document why.
- **Be transparent:** say what you collect and let users exercise their rights.
- **Own the export:** make sure you can get your data out at any time.

## Where open source fits

Open source helps on two fronts: you can *read* exactly how data is handled, and you can *self-host* so it never leaves your servers. Pug is AGPL-3.0 and self-hostable for this reason: your events stay in your own ClickHouse, on your own infrastructure, and a data subject is erased through one API call. If you are leaving Google Analytics over privacy, the [open-source Google Analytics alternative](https://pug.sh/compare/google-analytics-alternative) comparison covers the trade-offs in detail.

None of this is legal advice. Privacy law is nuanced and depends on context, but data minimisation plus self-hosting gives you a strong, defensible foundation to build on.

## Common questions

### What is privacy-first analytics?

Analytics that collects only the events and traits a question needs, stores no identifier on the visitor’s device until there is a basis to, shares nothing with ad networks, and keeps the data somewhere you control, ideally on your own servers.

### Does privacy-first analytics need a cookie banner?

Often not for the analytics itself. A tool that stores and reads nothing on the device gives the EU’s ePrivacy storage rule nothing to attach to, though other scripts on the page may still need consent, and requirements vary by jurisdiction. Confirm against your own legal advice.

### Which privacy laws apply to product analytics?

It depends on where your users are. The GDPR covers people in the EU and EEA and needs a lawful basis before you process. The CCPA covers California consumers and works on opt-out, with Global Privacy Control as a required signal. India’s DPDP Act is consent-first, with its Rules phased in from November 2025. Each has its own guide on this site.

### How does self-hosting help with privacy laws?

Self-hosting keeps event data in your own infrastructure instead of a vendor’s, which removes the cross-border transfer question and the vendor contract, and gives you direct control over retention, access and deletion. The obligations to the people in the data still sit with you.

### Is this legal advice?

No. This is general guidance on privacy-first analytics practices. Privacy laws are nuanced and differ by jurisdiction, so review your specific obligations with a qualified professional.
