Skip to main content
Persistent visitors lets CrispStats recognise the same browser on later days. You turn it on with one switch, Persistent visitors in the site’s settings, and then deploy the snippet the dashboard gives you, which now includes data-persist. The script creates a random id, keeps it in the browser’s localStorage under crispstats_vid, and sends it with every event. It is off by default, because it stores an identifier on the visitor’s device. Without it, CrispStats recognises a visitor for one day only, from a daily-rotating hash, and stores nothing in the browser.

Turn on persistent visitors

The setting and the attribute work together: the collector uses the id only while the setting is on, and the script creates an id only when the tag has data-persist. The dashboard keeps the two in step, so follow these steps in order.
1

Turn on the site setting

In the dashboard, open Settings, General, Persistent visitors and turn on Recognise returning visitors across days. Changing site settings needs the owner or admin role on the site.
2

Deploy the updated snippet

Open Settings, Tracking code. The snippet for your platform now includes data-persist, and the note under it says so. Copy it and replace the tag on your site:
If you write the tag by hand, add data-persist (data-persist="" in JSX) only while the setting is on.
3

Check that the id is stored

Open your site, then run this in the browser console:
It returns a string of digits. Visit the site again on a later day from the same browser and the visitor is counted as returning.

How it works

1

The script creates an id

On the first page load with data-persist, the script generates an id from 128 random bits with crypto.getRandomValues and saves it in localStorage.crispstats_vid. Later page loads reuse it. The id is random: it is not derived from the device, the IP address or the User-Agent.
2

Every event carries it

The script sends the id as vid with each event. crispstats.id() also passes it to the collector, so the visitor id you send to your payment provider at checkout matches the stored one.
3

The collector hashes it per site

When the site setting is on, the collector stores the first 32 hex characters of SHA-256("persist" | site id | id) as the visitor id. It has the same shape as a daily id, and the same browser gets a different value on each of your sites, so stored ids cannot be matched across sites. The raw id from localStorage is not stored. No salt rotation applies, so the id stays the same across days.
If the site setting is off, or the browser blocks localStorage, the event falls back to the daily hash. The IP address and User-Agent are still read for the browser, device, location and bot filtering, and discarded as usual.

What changes in your reports

  • Visitors over a period count each id once. Without persistent visitors, a visitor on three different days counts as three. See counting visitors.
  • Retention cohorts count returns on later days for persistent visitors, not only for visitors you identify.
  • Visitor profiles gather a browser’s visits from every day under one profile, with the source and landing page of its first visit.
The id is per browser. The same person on a phone and a laptop is still two visitors, and clearing site data starts a new id.
Persistent visitors stores an identifier on the visitor’s device. Under the ePrivacy Directive, UK PECR and similar rules, that generally requires the visitor’s consent first, and under GDPR the id is personal data. Turn it on only if you have a consent mechanism, or have established that you do not need one. This is a description of the feature, not legal advice.
The script reads data-persist once, when it starts, and a second copy of the script on the same page is ignored. To load it only after consent, inject the tag from your consent tool’s callback:
Call loadCrispStats(true) once the visitor has given consent, and loadCrispStats(false) otherwise. Call it once per page load, after your consent tool knows the visitor’s choice. If the script already started without data-persist on this page, the id is created from the next page load that includes the attribute. Stop adding data-persist for that visitor, and delete the stored id:
The visitor is then counted with the daily hash again. Events already stored under the persistent id are kept until your plan’s retention removes them.

Turning the setting off

When you turn Persistent visitors off, the collector stops using vid within about a minute, once its cached copy of your site settings refreshes, and uses the daily hash for new events. Ids already in visitors’ browsers stay there until they are cleared, and the script keeps sending them for as long as data-persist is on your tag. Remove the attribute as well if you no longer want them sent.

Learn more on crispstats.com

Next steps

Cookieless tracking

How the default daily id is built and why it cannot be linked across days.

Compliance facts

What each option changes, summarised for a privacy review.

Retention cohorts

See how often visitors come back on later days.
Last modified on November 23, 2026