Giter Site home page Giter Site logo

fingerprintjs / fingerprintjs-pro-flutter Goto Github PK

View Code? Open in Web Editor NEW
32.0 12.0 12.0 354 KB

A Flutter plugin for the native FingerprintJS Pro libraries

License: MIT License

Kotlin 8.94% Shell 0.90% Ruby 3.00% Swift 9.90% Objective-C 0.88% Dart 70.05% HTML 5.04% TypeScript 0.08% JavaScript 1.19%
dart fingerprint fingerprinting fingerprintjs fingerprintjs-pro flutter flutter-plugin fraud fraud-detection identification

fingerprintjs-pro-flutter's Introduction

Fingerprint logo

Build status Discord server

Fingerprint Pro Flutter

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.

Table of contents

Requirements

  • 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.

Dependencies

How to install

Add fpjs_pro_plugin to the pubspec.yaml in your Flutter app:

dependencies:
  flutter:
    sdk: flutter
  ...
  fpjs_pro_plugin: ^3.0.0

Run pub get to download and install the package.

Web platform

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>

Usage

To identify visitors, you need a Fingerprint Pro account (you can sign up for free).

1. Configure the plugin

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>'
  );
}

2. Use the plugin in your application code to identify a visitor

2.1 Use the getVisitorId method if you only need a visitorId:

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
    }
  }
}

2.2 Use getVisitorData to get extended result

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);
}

Linking and tagging information

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);
}

Additional Resources

Support and feedback

To report problems, ask questions or provide feedback, please use Issues. If you need private support, please email us at [email protected].

License

This project is licensed under the MIT license.

fingerprintjs-pro-flutter's People

Contributors

alexey-verkhovsky avatar borislobanov92 avatar ilfa avatar jurouhlar avatar makma avatar necipallef avatar petrpalata avatar semantic-release-bot avatar theunderscorer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fingerprintjs-pro-flutter's Issues

Android native plugin doesn't support AGP 8.0

Android Flutter plugins should add namespace under android inside the build configuration for the app.
Something like this.

Steps to reproduce

  • Create a new Flutter Application (empty)
  • Use Android Studio's "AGP Upgrade Assistant" to upgrade to Gradle 8
  • flutter pub add fpjs_pro_plugin

Also check official android documentation here.

Flutter Web Integration?

Hey guys. Is there a reason why you did not implement stuff for the flutter web platform? We use web, android and ios for our app.

Ask about Google and Apple privacy policies

My development team has a question: Does Fringerprint Pro qualify the Google and Apple privacy policies?
As I know, they changed their policies recently for mobile applications to reduce user tracking

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.