JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q21828F
  • License MIT

Browser-identity library with the highest accuracy and stability

Package Exports

  • browser-identity
  • browser-identity/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (browser-identity) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Using the browser-identity package

The browser-identity package is used to retrieve a visitor id related to the user's browser or environment.

Usage

Functions

getVisitorId This function takes one argument of type SourcesToComponents and returns a string, which represents the visitor identifier.

Usage

import { getVisitorId } from 'browser-identity';

const visitorId = getVisitorId(yourAttributes);
console.log(visitorId); // This will log the visitor identifier.

getVisitorData

This function takes one argument of type SourcesToComponents<typeof sources> and returns a Promise of type Agent, which includes various properties related to the visitor.

Usage

import { getVisitorData } from 'browser-identity';

getVisitorData(yourAttributes)
  .then((agent) => {
    console.log(agent.visitorId); // Visitor Identifier
    console.log(agent.confidence); // Confidence Score
    console.log(agent.attributes); // List of Components
  })
  .catch((error) => {
    console.error(error); // Handle any errors that occur during the retrieval of visitor data.
  });

The Agent interface represents the visitor's data and has the following properties:

  • visitorId: The visitor identifier.
  • confidence: A confidence score that indicates how certain the agent is about the visitor identifier.
  • attributes: A list of components that have formed the visitor identifier. Note that the type of this property may have incompatible changes within a major version.

The BuiltInComponents object contains various components and their corresponding values and durations. These components represent different aspects of the visitor's environment.

Here are some examples of the components included in BuiltInComponents:

  • applePay
  • architecture
  • audio
  • canvas
  • colorDepth
  • colorGamut
  • contrast
  • cookiesEnabled
  • cpuClass
  • deviceMemory
  • domBlockers
  • fontPreferences
  • fonts
  • forcedColors
  • hardwareConcurrency
  • hdr
  • indexedDB
  • invertedColors
  • languages
  • localStorage
  • math
  • monochrome
  • openDatabase
  • osCpu
  • pdfViewerEnabled
  • platform
  • plugins
  • privateClickMeasurement
  • reducedMotion
  • screenFrame
  • screenResolution
  • sessionStorage
  • timezone
  • touchSupport

Each component has a value and duration associated with it, which represents its value and how long it took to collect that data.

Please note that this is a general overview of how to use these functions and interfaces with the browser-identity package. You should refer to the specific documentation of the browser-identity package for more detailed information and any additional configuration or usage instructions.