New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

browser-identity

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browser-identity

Browser-identity library with the highest accuracy and stability

latest
Source
npmnpm
Version
1.2.0
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

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.

Keywords

fraud

FAQs

Package last updated on 18 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts