Fingerprint is a device intelligence platform offering 99.5% accurate visitor identification.
Fingerprint Pro Vue SDK is an easy way to integrate Fingerprint Pro into your Vue 3 application. It supports all capabilities of the Fingerprint JavaScript agent and provides a built-in caching mechanism.
You can use the plugin with Composition API, Options API, or Mixins, with or without Nuxt. See the usage examples below.
Composition API
The plugin provides a useVisitorData function you can use to identify visitors:
<script setup>
import { useVisitorData } from '@fingerprintjs/fingerprintjs-pro-vue-v3';
import { watch } from 'vue';
const { data, error, isLoading, getData } = useVisitorData(
{ extendedResult: true },
// Set to true to fetch data on mount
{ immediate: false }
);
watch(data, (currentData) => {
if (currentData) {
// Do something with the data
}
});
</script>
<template>
<button @click='getData'>Get visitor data</button>
</template>
Options API
The plugin injects a $fpjs object into your components that you can use to identify visitors:
The visitorId provided by Fingerprint Identification is especially useful when combined with information you already know about your users, for example, account IDs, order IDs, etc. To learn more about various applications of the linkedId and tag, see Linking and tagging information.
Associate your data with a visitor ID using the linkedId or tag parameter of the options object passed into the useVisitorData() hook or the getData function:
You can find detailed documentation in the API reference.
Caching strategy
Fingerprint Pro usage is billed per API call. To avoid unnecessary API calls, it is a good practice to cache identification results. By default, the SDK uses sessionStorage to cache results.
Specify cacheLocation in FpjsVueOptions to instead store results in memory or localStorage. Use none to disable caching completely.
Specify cache in FpjsVueOptions to use your custom cache implementation instead. For more details, see Creating a custom cache
in the Fingerprint Pro SPA repository (a lower-level Fingerprint library used by this SDK).
Pass {ignoreCache: true} to the getData()/getVisitorData()/getVisitorDataExtended() function to ignore cached results for that specific API call.
[!NOTE]
If you use data from extendedResult, pay additional attention to your caching strategy.
Some fields, for example, ip or lastSeenAt, might change over time for the same visitor. Use getData({ ignoreCache: true }) to fetch the latest identification results.
Support and feedback
To ask questions or provide feedback, use Issues. If you need private support, please email us at oss-support@fingerprint.com. If you'd like to have a similar Vue wrapper for the open-source FingerprintJS, consider creating an issue in the main FingerprintJS repository.
Examples
You can find the following examples in the examples directory:
We found that @fingerprintjs/fingerprintjs-pro-vue-v3 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 3 open source maintainers collaborating on the project.
Package last updated on 25 Mar 2024
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.