Scan analytics without storing IP addresses: how we count QR scans

Unique visitors, countries and devices, without keeping anyone's IP address or following them between codes. What a scan records and what it deliberately doesn't.

By The QRtoMany team5 min read

Every scan of a dynamic QR code is a request to a server, and a request carries more information than most people realise: an IP address, a description of the device, the languages the phone is set to, sometimes the page it came from. A QR analytics service could keep all of it. We keep much less, on purpose, and this post explains exactly what.

It matters to you as well as to the person scanning. If your codes feed a scan database full of IP addresses, you have a data protection question on every printed code you own.

What happens to the IP address

The IP address is used for four things, all inside the server that answers the scan, and it is gone before the scan is recorded anywhere:

  1. Location. The network provider looks the address up and gives us a country, region, city and time zone. That is all we keep from the lookup. Never coordinates, never an address.
  2. A/B test assignment. If the code runs an A/B split, the address helps put the same visitor in the same variant each time. The address is not stored as part of that.
  3. Counting unique visitors. More on this below.
  4. Rate-limiting repeated password or age-gate attempts. A wrong guess is throttled by an address-keyed counter that lives entirely inside Cloudflare's rate limiter — never stored by us, never written to a queue, a log or an error report.

The address itself is never written to our database, our analytics store, our logs or our error reports. That is a rule of the codebase, not a setting.

Counting unique visitors without identifying anyone

"How many different people scanned this?" is the question everyone asks, and the usual answer is to keep something that identifies each person. We don't. For each scan we compute a visitor hash:

visitor hash = SHA-256( IP address + device description + which code + today's secret salt )

Each ingredient does a job:

  • The IP address and device description tell one visitor from another.
  • Which code means the same person scanning two of your codes produces two unrelated hashes. Nobody can follow a visitor from one code to another with the data we keep. Not you, not us.
  • The salt is a random secret that is replaced every day, and the old one is destroyed. Once it is gone, nobody can recompute yesterday's hashes from an IP address, and today's hashes can't be matched to yesterday's.

So what you get is unique visitors per code, per day. The same person scanning on Monday and again on Tuesday counts once each day. That is the honest limit of counting without a lasting identifier, and we prefer it to the alternative.

In other words, every scan is counted with a pseudonymous daily ID that changes every 24 hours and is different for every code, so the ID itself cannot link the same person across days or codes. That makes the hash pseudonymous, not anonymous. Neither we nor you can tell who a scan was, but a scan record still holds a city, a device and a time, so we treat scan records as personal data under the GDPR and protect them that way.

What a scan record contains

Each scan is stored with:

  • when it happened, which code, and which routing rule (and A/B variant) sent it where;
  • country, region, city and time zone;
  • device type, operating system and browser;
  • the visitor's first language only, not their whole language list;
  • where the scan came from, reduced to the website's name only (no page path or query string, which could identify the person);
  • the day's visitor hash;
  • whether it looked like a bot or a link-preview crawler, so those are left out of your counts.

Individual scan records are deleted automatically after 14 months. Your long-term daily totals are kept, but they are only counts.

Cookies

A scan of an ordinary code sets no cookie at all. A scan can set up to four small cookies, each only on a code that uses the feature it serves. None of them contain anything about the person:

  • A returning-visitor marker, only on codes with a returning-visitor rule. The first time a browser scans such a code, it gets a cookie that says only "this browser has scanned this code before". It has no identifier and no count. It is what lets a returning-visitor rule, such as "first scan gets the welcome offer", tell a first scan from a later one.
  • An A/B assignment, only on codes running an A/B split. It remembers which variant the browser got, so a returning visitor sees the same one. It holds the rule and the variant number, nothing more.
  • A password-gate session, only on a password-gated code, set once the visitor answers correctly. It holds a signed token good for 12 hours, so the gate doesn't re-prompt on every scan within that window.
  • An age-gate session, only on an age-gated code: the same kind of signed token, set once the visitor confirms the age gate.

Each cookie's name is specific to its own code, and we only ever read back the one matching the code being scanned. But every one of them is set on the whole redirect domain, not scoped to that one code, so a browser hands over its entire history of scanned codes here with every request — we just don't look at the names that don't match. Refusing the returning-visitor or A/B cookie doesn't break anything: the scan still lands, and the visitor is simply treated as new. Refusing a gate's session cookie does: the gate has nothing else to remember you by, so it asks again on the very next scan.

What this doesn't cover

Everything above is about what we record when a code is scanned. The page the scan lands on is yours, and whatever it collects is between you and your visitors. Your own obligations also depend on your use and your jurisdiction. This post describes how our system works. It is not legal advice.

Why build it this way

Scan analytics are useful, and most of their value (volume over time, countries, devices, which rule fired) needs nothing that identifies a person. We would rather give up precision we can't justify than store data we would one day have to explain. Every scan becomes a record, across every code we serve, so the privacy decision has to be made once, in the design, and not left to a setting.

About the author

The QRtoMany team

We build QRtoMany, a dynamic QR code service designed around one fact: a printed code can't be recalled. These posts are written from what we have built, and the numbers in them come from the product itself.

Try the routing on your own codes

Create a free account to get started, then request Pro to route your own codes — or make a static code with no account at all.

All posts
Scan analytics without storing IP addresses: how we count QR scans · QRtoMany