Browser fingerprinting library with the highest accuracy and stability for generating unique visitor identifiers
—
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Pending
The risk profile of this skill
Agent loading and management functionality for initializing the FingerprintJS system with performance optimizations and configuration options.
Creates and initializes a FingerprintJS agent instance with optional configuration.
/**
* Builds an instance of Agent and waits for proper operation
* @param options - Optional configuration for agent loading
* @returns Promise resolving to initialized Agent instance
*/
function load(options?: LoadOptions): Promise<Agent>;
interface LoadOptions {
/**
* Fallback delay in milliseconds for browsers without requestIdleCallback support
* @default 50
*/
delayFallback?: number;
/**
* Whether to print debug messages to the console
* @default false
*/
debug?: boolean;
}Usage Examples:
import FingerprintJS from '@fingerprintjs/fingerprintjs';
// Basic loading
const fp = await FingerprintJS.load();
// With custom delay fallback
const fp = await FingerprintJS.load({
delayFallback: 100
});
// With debug enabled
const fp = await FingerprintJS.load({
debug: true
});The main agent instance that provides fingerprint generation capabilities.
interface Agent {
/**
* Gets the visitor identifier and associated data
* @param options - Optional configuration for fingerprint generation
* @returns Promise resolving to fingerprint result
*/
get(options?: GetOptions): Promise<GetResult>;
}
interface GetOptions {
/**
* Whether to print debug messages (deprecated - use debug option in load())
* @deprecated Use the debug option of load() instead
*/
debug?: boolean;
}Usage Examples:
// Get fingerprint with default options
const result = await fp.get();
// Get fingerprint with debug (deprecated approach)
const result = await fp.get({ debug: true });Early Initialization: Load the agent as early as possible in your application lifecycle for optimal performance:
// Initialize at application startup
const fpPromise = FingerprintJS.load();
// Use later when needed
async function identifyUser() {
const fp = await fpPromise;
const result = await fp.get();
return result.visitorId;
}Browser Environment Detection: The library automatically handles different browser environments and loading contexts:
// Works in all environments
const fpPromise = FingerprintJS.load();
// Browser compatibility is handled internally
// - Uses requestIdleCallback when available
// - Falls back to setTimeout with configurable delay
// - Optimizes entropy source loading orderThe delayFallback parameter controls timing for browsers without requestIdleCallback support (primarily Safari and older Edge):
// Default delay (recommended)
const fp = await FingerprintJS.load(); // Uses 50ms fallback
// Custom delay for specific use cases
const fp = await FingerprintJS.load({
delayFallback: 200 // Longer delay for heavily loaded pages
});
const fp = await FingerprintJS.load({
delayFallback: 10 // Shorter delay for performance-critical applications
});