Fingerprint is a device intelligence platform offering industry-leading accuracy.
Fingerprint Pro React Native SDK is an easy way to integrate Fingerprint Pro into your React Native
application to call the native Fingerprint Pro libraries (Android and iOS) and identify devices.
2. Configure iOS dependencies (if developing on iOS)
1cd ios && pod install
3. Configure Android dependencies (if developing on Android)
Add the repositories to your Gradle configuration file. The location for these additions depends on your project's structure and the Gradle version you're using:
Gradle 7 or newer
For Gradle 7.0 and higher (if you've adopted the new Gradle settings file approach), you likely manage repositories in the dependencyResolutionManagement block in {rootDir}/android/settings.gradle. Add the Maven repositories in this block:
1import React, { useEffect } from'react';
2import { FingerprintJsProAgent } from'@fingerprintjs/fingerprintjs-pro-react-native';
34// ... 56useEffect(() => {
7asyncfunctiongetVisitorInfo() {
8try {
9const FingerprintClient = new FingerprintJsProAgent({ apiKey: 'PUBLIC_API_KEY', region: 'eu' }); // Region may be 'us', 'eu', or 'ap'10const visitorId = await FingerprintClient.getVisitorId(); // Use this method if you need only visitorId11const visitorData = await FingerprintClient.getVisitorData(); // Use this method if you need additional information about visitor12// use visitor data in your code13 } catch (e) {
14console.error('Error: ', e);
15 }
16 }
17 getVisitorInfo();
18}, []);
extendedResponseFormat
Two types of responses are supported: "default" and "extended". You don't need to pass any parameters to get the "default" response.
"Extended" is an extended result format that includes geolocation, incognito mode and other information.
It can be requested using the extendedResponseFormat: true parameter. See more details about the responses in the documentation.
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.
1const tag = {
2userAction: 'login',
3analyticsId: 'UA-5555-1111-1'4};
5const linkedId = 'user_1234';
67// Using hooks8const { getData } = useVisitorData();
9const visitorData = await getData(tag, linkedId);
1011// Using the client12const FingerprintClient = new FingerprintJsProAgent({ apiKey: 'PUBLIC_API_KEY'});
13const visitorId = await FingerprintClient.getVisitorId(tag, linkedId);
14const visitor = await FingerprintClient.getVisitorData(tag, linkedId);