diff --git a/docs/api.md b/docs/api.md index 83790d42..8735b8cf 100644 --- a/docs/api.md +++ b/docs/api.md @@ -53,16 +53,6 @@ A request includes the following information: - The HTTP headers that the client sends, including the origin and the referrer of the page where the library runs - The IP of the client -You can turn off these requests by using the `monitoring` option: - -```diff -const botdPromise = BotD.load({ -+ monitoring: false -}) -``` - -💡 Scripts downloaded from our CDN (https://openfpcdn.io) have monitoring disabled by default. - ### CommonJS syntax: ```js @@ -77,7 +67,7 @@ load() ## API -#### `BotD.load({ monitoring?: boolean }): Promise` +#### `BotD.load(): Promise` Builds an instance of `BotDetector`. We recommend calling it as early as possible, ideally during application startup. It returns a promise which you can chain on to call `BotDetector` methods later. diff --git a/src/index.ts b/src/index.ts index e3b9bbcf..7960f33a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,17 +3,6 @@ import BotDetector from './detector' import { sources, WindowSizePayload, ProcessPayload, DistinctivePropertiesPayload } from './sources' import { BotdError, BotDetectorInterface, BotKind, BotDetectionResult } from './types' -/** - * Options for BotD loading - */ -export interface LoadOptions { - /** - * Set `false` to disable the unpersonalized AJAX request that the agent sends to collect installation statistics. - * It's always disabled in the version published to the FingerprintJS CDN. - */ - monitoring?: boolean -} - /** * Sends an unpersonalized AJAX request to collect installation statistics */ @@ -33,8 +22,8 @@ function monitor() { } } -export async function load({ monitoring = true }: Readonly = {}): Promise { - if (monitoring) { +export async function load(options?: Record): Promise { + if (options?.monitoring ?? true) { monitor() } const detector = new BotDetector()