Caching visitor information

A visitorId generated per page view across all pages on a site can lead to unexpected and excess API usage. We recommend storing the visitorId per browser session to minimize the identifications of a visitor as they navigate your site from one browser tab.



Values stored in sessionStorage, localStorage, and cookies are not available from Incognito mode, so these caching attempts will not work if a visitor switches from normal to private browsing (or vice versa).

Caching methods


sessionStorage is one solution to cache the Fingerprint Pro visitorId per user session. Unlike localStorage, this property is automatically cleared when the page session ends (i.e. closing the browser tab or window).

First, perform a check whether sessionStorage contains a visitorId by wrapping an if statement around fpPromise. If visitorId does not exist (condition is false), perform a Fingerprint Pro API request using the fp.get() method. When the promise is resolved, write the visitorId to sessionStorage.

Learn more about sessionStorage here:


An alternative approach to sessionStorage is to store information by JavaScript-set cookies. The concept is similar where a check for an existing visitorId is performed, and if the cookie does not exist only then is a request made to Fingerprint Pro. The difference is that cookies require an expiration date defined by the developer. We recommend storing a visitorId no longer than 24 hours.

Learn more about cookies here:

Single-Page Applications

If you are using Fingerprint Pro in a single-page application built with frameworks like React, Vue, or Angular, we recommend using our dedicated open-source packages. These wrappers offers caching options for sessionStorage or localStorage.


Important Note

For high identification accuracy, we recommend caching the visitorId for no longer than 24 hours.