Skip to content
Start free trial
BlogPrivacy-first analytics

IP anonymisation in analytics: why not storing beats masking

Most IP anonymisation masks part of the address and keeps the rest. Here’s what analytics uses an IP for, why masking is weaker than it sounds, and what not storing one looks like.

Imagine your developer tells you the analytics is privacy-safe because IP anonymisation is switched on. Then you open a data export and find rows of addresses like 203.0.113.0. Is that anonymous?

Usually, not really. IP anonymisation in analytics generally means one thing: before the address is stored, its last part is replaced with a zero. That’s a reasonable step, but it’s much weaker than the name suggests.

In this post you’ll see what analytics actually needs an IP address for, what masking does and doesn’t protect, and how a tool can use an address for a moment and keep it for no time at all.

Key takeaways

  • Analytics uses an IP address for three jobs: telling visitors apart, filtering bots and abuse, and estimating location.
  • IP anonymisation usually means masking the last part of the address, which keeps most of it and narrows a person to a small block.
  • Masked IPs and unsalted IP hashes are generally still personal data. Not storing the address at all is a different level of protection.
  • FunnelSights uses the IP only during the request, as one input to a daily hash and to resolve location where that’s set up, and never writes it down.
  • Not storing IPs has a cost: no IP-based rules or re-analysis after the fact.

What does analytics use an IP address for?

Every request a browser makes carries the IP address it came from. An analytics endpoint receives it whether it wants it or not, and tools then use it for some mix of three jobs.

  • Telling visitors apart. Without a cookie, the IP address (usually with the user agent) is the main sign that two requests came from the same browser.
  • Filtering bots and abuse. Some tools block known data-centre ranges, rate-limit per address, or exclude your own office by address.
  • Estimating location. An IP can be looked up in a geolocation database to give a country, and often a region and city.

None of these jobs needs the address to be kept. Each one needs it at the moment the request arrives, and that idea runs through the rest of this post.

How does IP anonymisation usually work?

The usual technique is truncation. Take an IPv4 address like 203.0.113.42: the last of its four numbers, called the last octet, is set to zero, leaving 203.0.113.0.

For IPv6 addresses, a bigger chunk is cleared. The shortened address is then stored instead of the full one and used for location and reporting, which is what turned up in your export.

Universal Analytics offered exactly this as a setting, and many tools still do. Google says GA4 doesn’t log or store IP addresses at all, which is why the old setting has no GA4 equivalent.

Why is masking the last octet weaker than not storing?

Truncation narrows an address from one connection to a block of 256. That sounds like a lot of doubt, but in practice it’s often very little.

  • A block of 256 addresses often belongs to one organisation, one building or one small area. For a business visitor, the masked address can still name the company.
  • Combine it with a timestamp, a user agent and the pages viewed, and the remaining doubt usually disappears.
  • The masked value is stored, so it lasts as long as the data does, and anyone who later gets access to the data gets it too.
  • Regulators haven’t generally accepted truncation alone as making an address anonymous, especially when it sits next to other identifiers.

Hashing on its own isn’t much better. There are only about four billion IPv4 addresses, so an unsalted hash of one can be reversed by hashing them all and looking up the match.

A hash keyed with a secret that changes is stronger, because nobody can reproduce it without the key. But the strongest option is also the simplest: don’t write the address down at all.

Ways to handle an IP address in analytics
What is storedCan it be linked back?
Store it in fullThe whole addressYes, directly
Mask the last octetThree-quarters of the addressOften, with the other fields
Hash without a secretA hash of the addressYes, by hashing every address
Hash with a rotating, deleted keyA per-day hash, never the addressOnly while the key exists
Use it in the request and drop itNothingNothing is left to link

FunnelSights combines the last two: the address is one input to a per-day hash and is never stored.

What does FunnelSights do with an IP address?

In FunnelSights, the IP address is used during the request and then dropped with it. It’s never written to the analytics database.

What happens to an IP address at ingest
  1. ReadThe address is taken from the forwarded-for header if a proxy set one, or from the connection itself.
  2. HashIt’s combined with the user agent and the site’s domain and hashed under the day’s salt. That hash is the visitor ID for the day.
  3. LocateWhere location is set up, the address is resolved to a country, region and city in the same request.
  4. DropThe request ends and the address goes with it. What’s stored is the event, the hash and any place names.

The salt is deleted after 48 hours, after which the hash can’t be recomputed by anyone.

Counting visitors

The address is one of three inputs to a hash keyed with a random salt that rotates every 24 hours and is deleted after 48. Within a day, the hash recognises the same browser on the same network, which lets pageviews stitch into visits.

Once the salt is deleted, nobody can work out which address produced which hash. How cookieless visitor counting works covers the mechanism and what it costs in accuracy.

Location

Location can come from two places, and neither needs the address to be stored. A geo-aware proxy or CDN in front of the endpoint can send the visitor’s country, and often region and city, as request headers. Without one, a geolocation database on the server can resolve the address on the spot.

Either way, only the place name is kept. If neither source is set up, location is recorded as unknown rather than guessed.

Bots and spam

Bot filtering doesn’t need the address either. Bots are identified at ingest from their user agent, against a maintained crawler database and a list of named bots, and counted in a separate bot report instead of your traffic.

Referrer spam is dropped against a maintained spam list, and the rate limit that protects ingest works per site, not per address. Bot traffic and referrer spam covers both in more detail.

Who else sees the address

The address isn’t invisible to everything along the way. The hosting provider’s edge handles the connection, so it sees request addresses in transit, as every web host does. That’s named in the sub-processor register, along with every other third party that can access data.

If you proxy the endpoint

You can serve the tracking endpoint through your own domain. If you do, set the proxy to pass the visitor’s address in the X-Forwarded-For header.

Otherwise every request seems to come from the proxy’s own address, and visitors using the same browser version merge into one.

What do you give up by not storing IP addresses?

Keeping no address is a trade-off, so it helps to know the cost:

  • No rules after the fact. You can’t go back and exclude a range of addresses from last month’s data, because last month’s addresses don’t exist.
  • No re-analysis. If a better location database comes along, past traffic can’t be re-located with it.
  • No excluding your team by IP from stored data. Exclusion has to happen in the browser or through path rules instead.
  • No recognising people across days. The address can’t tell you a visitor came back next week.

For most sites, those are small losses next to not holding a list of every visitor’s network address. If your work depends on any of them, it’s better to know before you choose a tool.

Questions to ask any analytics vendor about IP addresses

Back to that export full of addresses ending in zero. Before you settle on a tool, put these questions to the vendor:

  • Is the IP address stored at all, in any form: full, masked or hashed?
  • If it’s hashed, is the hash keyed with a secret, and how often does the secret change?
  • How is location worked out, and is the address kept after the lookup?
  • Do bot filtering and rate limiting rely on stored addresses?
  • Which third parties see addresses in transit, and are they named?
  • Do server logs record addresses, and for how long?

Whether a masked or hashed IP counts as personal data in your setup is a legal question, covered in outline in is analytics data personal data?. How long to keep the rest of your analytics data is in analytics data retention, and the wider model is in the cookieless analytics guide.

Frequently asked questions

What is IP anonymisation in analytics?

It usually means removing part of a visitor’s IP address before it’s stored, typically by setting the last of the four numbers in an IPv4 address to zero. The rest of the address is kept and used for location and reporting.

Is a masked IP address still personal data?

Often, yes. Masking the last octet narrows an address to a block of 256, which can still point at an organisation or a small area, and combined with timestamps and browser details it can single someone out. Regulators generally treat it as personal data in those circumstances.

Does GA4 anonymise IP addresses?

Google says GA4 doesn’t log or store IP addresses, so there’s no separate anonymisation setting as there was in Universal Analytics. The address is still received with each request, as it is by any analytics tool.

Can analytics show visitor location without storing IP addresses?

Yes. Location can be resolved during the request, either from headers a geo-aware proxy adds or from a geolocation database on the server, and only the country, region and city kept. The address itself never needs to be written down.

Does hashing an IP address make it anonymous?

Not on its own. An unsalted hash can be reversed by hashing every possible address. A hash keyed with a secret that is rotated and deleted is much stronger, because once the key is gone the hash can’t be recomputed, but whether that counts as anonymous is a legal judgement.

More in this series

This post is part of Cookieless analytics: how it works, what it costs, and how to choose, our guide to privacy-first analytics.

  • Do you need a cookie banner for analytics?You’ve switched to cookieless analytics and someone asks if the banner can finally go. The answer turns on two different rules and on where your visitors are. Here’s how to think it through.
  • How cookieless tracking counts unique visitorsWithout a cookie, a visitor is recognised from the request itself and forgotten a day later. Here’s the daily salted hash step by step, and what it means for your visitor numbers.
  • Is analytics data personal data under the GDPR?A client’s questionnaire asks whether your analytics processes personal data, and you’re not sure what to write. Here’s how IP addresses, IDs, hashes and aggregates are generally treated.
  • Analytics data retention: how long to keep whatA client asks how long you keep their visitors’ analytics data, and you realise nobody ever decided. Here’s why retention matters, how to choose a period for each kind of data, and what FunnelSights keeps.