@rebilly/risk-data-collector

6.0.2 • Public • Published

risk-data-collector

npm version

Collect browser data for risk assessment purposes.

Description

risk-data-collector is a client side microlibrary which collects user data required for the risk assessment component of 3DS v2.

Data collected

  • colorDepth
  • javaEnabled
  • language
  • screenHeight
  • screenWidth
  • timeZoneOffset
  • deviceFingerprintHash
  • kountFraudSessionId (optional)

Usage

risk-data-collector is distributed in two ways:

Via a CDN link

The library becomes available under the RiskDataCollector global namespace and can be used like so:

<html>
  <head>
    <script src="https://cdn.rebilly.com/risk-data-collector/@latest/data-collector.js"></script>
  </head>

  <body>
    <script type="text/javascript">
      (async () => {
        const browserData = await RiskDataCollector.collectData();
        console.log(`browserData is: ${JSON.stringify(browserData)}`);
      })();
    </script>
  </body>
  <html></html>
</html>

Note: You can replace @latest with @<version> (Example @1.0.0). To pin to a specific version.

As an npm package

yarn add @rebilly/risk-data-collector

npm install @rebilly/risk-data-collector

Which can be imported and used like so:

import { collectData } from '@rebilly/risk-data-collector';

(async () => {
  const browserData = await collectData();
  console.log(`browserData is: ${JSON.stringify(browserData)}`);
})();

Kount

risk-data-collector works with Kount to collect kountFraudSessionId.

If you already have an account with Kount, you can use it with risk-data-collector by providing:

  • env - sandbox or production, determines which Kount environment to use (defaults to sandbox)
  • kountAccountId - your Kount account ID
  • (optional) kountSessionId - 32 character session ID, omit to have Kount generate a session ID for you

Example:

import { collectData } from '@rebilly/risk-data-collector';

(async () => {
  const env = 'production';
  const kountAccountId = '123456';
  const browserData = await collectData({ env, kountAccountId });
  console.log(`browserData is: ${JSON.stringify(browserData)}`);
})();

Package Sidebar

Install

npm i @rebilly/risk-data-collector

Weekly Downloads

41

Version

6.0.2

License

MIT

Unpacked Size

467 kB

Total Files

7

Last publish

Collaborators

  • adamaltman
  • romanhotsiy
  • mike.classic
  • rebilly-npm-machine-user