UNPKG

@fingerprintjs/fingerprintjs-pro

Version:

Fingerprint JavaScript agent

86 lines (63 loc) 3.01 kB
<p align="center"> <br> <a href="https://fingerprint.com"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://fingerprintjs.github.io/home/resources/logo_light.svg" /> <source media="(prefers-color-scheme: light)" srcset="https://fingerprintjs.github.io/home/resources/logo_dark.svg" /> <img src="https://fingerprintjs.github.io/home/resources/logo_dark.svg" alt="Fingerprint logo" width="312px" /> </picture> </a> </p> Makes a website visitor identifier from a browser fingerprint. Unlike cookies and local storage, fingerprint stays the same in incognito/private mode and even when browser data is purged. Provides additional information and higher accuracy compared to Open Source FingerprintJS. ## Quick start Get a pro key: 1. Register a new PRO account at [dashboard.fingerprint.com/signup](https://dashboard.fingerprint.com/signup) (there is a free trial) 2. After registration go to the [dashboard](https://dashboard.fingerprint.com) and select the created subscription 3. Go the "API Keys" page in the navigation side bar on the left side of the page 4. Copy a key with type "Public" ### Install from NPM ```bash npm i @fingerprintjs/fingerprintjs-pro # or yarn add @fingerprintjs/fingerprintjs-pro ``` ```js import FingerprintJS from '@fingerprintjs/fingerprintjs-pro' // Initialize an agent at application startup. const fpPromise = FingerprintJS.load({ apiKey: 'your-pro-key' }) ;(async () => { // Get the visitor identifier when you need it. const fp = await fpPromise const result = await fp.get() // This is the visitor identifier: const visitorId = result.visitorId console.log(visitorId) })() ``` [Run this code](https://stackblitz.com/edit/fpjs-pro-3-npm?file=index.js&devtoolsheight=100) ### Alternatively you can install from CDN ```html <script> // Initialize the agent at application startup. const fpPromise = import('https://fpjscdn.net/v3/your-pro-key') .then(FingerprintJS => FingerprintJS.load()) // Get the visitor identifier when you need it. fpPromise .then(fp => fp.get()) .then(result => { // This is the visitor identifier: const visitorId = result.visitorId console.log(visitorId) }) </script> ``` Note that you need to replace `your-pro-key` with a public API key from the [dashboard](https://dashboard.fingerprint.com). [Run this code](https://stackblitz.com/edit/fpjs-pro-3-cdn?file=index.html&devtoolsheight=100) ## See also 🍿 [Live demo](https://fingerprint.com/demo) ⏱ [How to upgrade from Open Source to Pro in 30 seconds](https://dev.fingerprint.com/v3/docs/migrating-from-fingerprintjs-to-fingerprint-pro#migrating-from-fingerprintjs-v3-open-source-to-pro) ⬆️ [How to migrate from Fingerprint version 2](https://dev.fingerprint.com/v3/docs/migrating-from-pro-v2) 📕 [Fingerprint documentation](https://dev.fingerprint.com) ▶️ [Video: use Fingerprint to prevent multiple signups](https://www.youtube.com/watch?v=jWX9P5_jZn8)