Fingerprint is a device intelligence platform offering 99.5% accurate visitor identification. Fingerprint Pro Flutter SDK is an easy way to integrate Fingerprint Pro into your Flutter application to call the native Fingerprint Pro libraries (Android, iOS and Web) and identify devices.
- Flutter 3.10 or higher
- Android 5.0 (API level 21+) or higher
- iOS 13+/tvOS 15+, Swift 5.7 or higher (stable releases)
We aim to keep the Flutter compatibility policy.
Add fpjs_pro_plugin
to the pubspec.yaml in your Flutter app:
dependencies:
flutter:
sdk: flutter
...
fpjs_pro_plugin: ^3.0.1
Run pub get
to download and install the package.
Add a <script>
tag with the JS agent loader inside the <head>
tag in your HTML template to use fpjs_pro_plugin
:
<script src="assets/packages/fpjs_pro_plugin/web/index.js" defer></script>
To identify visitors, you need a Fingerprint Pro account (you can sign up for free).
- Go to the Fingerprint Pro dashboard.
- Navigate to App Settings > API Keys to find your Public API Key.
import 'package:fpjs_pro_plugin/fpjs_pro_plugin.dart';
// ...
// Initialization
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
doInit();
}
void doInit() async {
await FpjsProPlugin.initFpjs(
'<apiKey>' // insert your actual API key here
);
}
// ...
}
You can also configure region
and endpoint
in the initFpjs
method, like below. For the web platform, you can use an additional scriptUrlPattern
property to specify a custom URL for loading the JavaScript agent. This is required for proxy integrations.
void doInit() async {
await FpjsProPlugin.initFpjs(
'<apiKey>',
endpoint: 'https://subdomain.domain.com',
region: Region.eu, // or Region.ap, Region.us
// Only necessary for the web platform
scriptUrlPattern: 'https://your.domain/fp_js/script_path?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>'
);
}
import 'package:fpjs_pro_plugin/fpjs_pro_plugin.dart';
// ...
// Initialization
class _MyAppState extends State<MyApp> {
// ...
// Usage
void identify() async {
try {
visitorId = await FpjsProPlugin.getVisitorId() ?? 'Unknown';
// use the visitor id
} on FingerprintProError catch (e) {
// process an error somehow
// check lib/error.dart to get more info about error types
}
}
}
import 'package:fpjs_pro_plugin/fpjs_pro_plugin.dart';
// ...
// Initialization
class _MyAppState extends State<MyApp> {
// ...
// Usage
void identify() async {
try {
deviceData = await FpjsProPlugin.getVisitorData();
// use the visitor id
} on FingerprintProError catch (e) {
// process an error somehow
// check lib/error.dart to get more info about error types
}
}
}
By default getVisitorData()
will return a short response with the FingerprintJSProResponse
type.
Provide extendedResponseFormat=true
to the initFpjs
function to get extended result of FingerprintJSProExtendedResponse
type.
void doInit() async {
await FpjsProPlugin.initFpjs('<apiKey>', extendedResponseFormat: true);
}
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.
void identify() async {
const tags = {
userAction: 'login',
analyticsId: 'UA-5555-1111-1'
};
const linkedId = 'user_1234';
visitorId = await FpjsProPlugin.getVisitorId(linkedId: linkedId, tags: tags);
deviceData = await FpjsProPlugin.getVisitorData(linkedId: linkedId, tags: tags);
}
To report problems, ask questions or provide feedback, please
use Issues. If you need private support, please
email us at oss-support@fingerprint.com
.
This project is licensed under the MIT license.