@govuk-one-login/frontend-device-intelligence
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published


GOV.UK Frontend Device Intelligence

This package enables GOV UK LOGIN frontend Node.js applications to use fingerprinting for analysis.
Explore the docs »

Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started

About The Project

The GDS One Login Device Intelligence node package is a shared, reusable nunjuck component created to facilitate the integration of fingerprinting for analysis.

The purpose of this package is to make it as easy as possible for the various pods that make up the One Login journey to collect data in identifying a unique visitor correctly.

The package is owned by the DI Frontend Capability team, part of the development of this package involves ongoing discovery with the pods responsible for maintaining the frontend repositories that make up the One Login journey. As more information is collated, the package and documentation will be updated. As such, it is considered a WIP and the pods will be notified when a stable release is ready.

(back to top)

Getting Started

Prerequisites and Installation

Top level of the monorepo:

npm install
npm run build

Or Add to your project using npm i @govuk-one-login/frontend-device-intelligence

Testing

To test the Device Intelligence package in the One Login Frontend monorepo, follow these steps:

  1. Complete the prerequisites and installation steps.
  2. Add the /fingerprint path to the app.js so that the application utilises the device intelligence package from the govuk-one-login node modules.

  3. Add the usage of the fingerprint into the web page by adding in the script into the base nunjucks file. Declare alongside the rest of the scripts in nunjucks context block.
  4.   <script src="/fingerprint/index.js"></script>
      <script>
        console.log(window.ThumbmarkJS.getFingerprint())
        console.log(window.ThumbmarkJS.getFingerprintData())
        console.log(window.ThumbmarkJS.setFingerprintCookie())
      </script>
    
  5. Update the rollup.config.js file to support 'iife' format for browsers.
  6.   {
        file: "build/iife/index.js",
        format: "iife",
        name: "ThumbmarkJS"
      }
    
  7. Run npm start in the alpha app directory and application should be available at http://localhost:3000. Once loaded, inspect the console to view the result of printing out the fingerprint ID.

Developing the package

See monorepo instructions for building, testing, and publishing packages.

(back to top)

Package Sidebar

Install

npm i @govuk-one-login/frontend-device-intelligence

Weekly Downloads

699

Version

1.2.0

License

MIT

Unpacked Size

158 kB

Total Files

199

Last publish

Collaborators

  • pcornishgds
  • nickheal-gds
  • merlinc
  • wilsondrrn
  • caitlin-cooling