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).
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
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: https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage
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: https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie
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.
For high identification accuracy, we recommend caching the
visitorIdfor no longer than 24 hours.
Updated 5 months ago