# Detect bots on the web
> Detect automated browsers client-side using FingerprintJS BotD and attach a bot detection entity to every event.
> Source: https://docs.snowplow.io/docs/sources/web-trackers/tracking-events/bot-detection/
> Documentation index: https://docs.snowplow.io/llms.txt

The bot detection plugin uses [FingerprintJS BotD](https://github.com/fingerprintjs/Botd) to detect automated browsers such as Selenium, PhantomJS, or headless Chrome. It attaches a `client_side_bot_detection` [entity](/docs/fundamentals/entities/) to every event.

This is useful when you want to identify bot traffic as early as possible, before events reach your pipeline. For a broader approach that also incorporates server-side indicators, see the [bot detection enrichment](/docs/pipeline/enrichments/available-enrichments/bot-detection-enrichment/).

> **Note:** The plugin is available since version 4.7 of the tracker.

The bot detection entity is **automatically tracked** once configured.

## Install the plugin

**JavaScript (tag):**

| Tracker Distribution | Included |
| -------------------- | -------- |
| `sp.js`              | ❌        |
| `sp.lite.js`         | ❌        |

**Download:**

|                                             |                                                                                                              |
| ------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| Download from GitHub Releases (Recommended) | [Github Releases (plugins.umd.zip)](https://github.com/snowplow/snowplow-javascript-tracker/releases)        |
| Available on jsDelivr                       | [jsDelivr](https://cdn.jsdelivr.net/npm/@snowplow/browser-plugin-bot-detection@4.10.2/dist/index.umd.min.js) |
| Available on unpkg                          | [unpkg](https://unpkg.com/@snowplow/browser-plugin-bot-detection@4.10.2/dist/index.umd.min.js)               |

> **Note:** The links to the CDNs above are pinned to a specific version at the time of writing. Check the [plugin's GitHub releases](https://github.com/snowplow/snowplow-javascript-tracker/releases) for newer versions, and update the pinned version when you upgrade.

```javascript
window.snowplow('addPlugin',
  "https://cdn.jsdelivr.net/npm/@snowplow/browser-plugin-bot-detection@4.10.2/dist/index.umd.min.js",
  ["snowplowBotDetection", "BotDetectionPlugin"]
);
```

**Browser (npm):**

- `npm install @snowplow/browser-plugin-bot-detection`
- `yarn add @snowplow/browser-plugin-bot-detection`
- `pnpm add @snowplow/browser-plugin-bot-detection`

```javascript
import { newTracker } from '@snowplow/browser-tracker';
import { BotDetectionPlugin } from '@snowplow/browser-plugin-bot-detection';

newTracker('sp1', '{{collector_url}}', {
   appId: 'my-app-id',
   plugins: [ BotDetectionPlugin() ],
});
```

***

## Output

The plugin attaches a `client_side_bot_detection` entity to every event.

### `client_side_bot_detection`

**Type:** Schema

Schema for bot detection entity, powered by the BotD library (https\://github.com/fingerprintjs/BotD)

**Properties:**

| Property        | Description                                                                                                                                                                                                                                                                                                                                                                                               |
| --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `bot` _boolean_ | _Required._ Whether the current browser is identified as a bot                                                                                                                                                                                                                                                                                                                                            |
| `kind` _string_ | _Optional._ The type of bot detected. Populated when bot is true, null or omitted otherwise. See https\://github.com/fingerprintjs/BotD/blob/main/src/types.ts Must be one of: `awesomium`, `cef`, `cefsharp`, `coachjs`, `electron`, `fminer`, `geb`, `nightmarejs`, `phantomas`, `phantomjs`, `rhino`, `selenium`, `sequentum`, `slimerjs`, `webdriverio`, `webdriver`, `headless_chrome`, `unknown`,`` |

> **Note: Asynchronous detection**
>
> Bot detection runs asynchronously. Events tracked before detection completes won't have this entity attached. In most cases, detection finishes within milliseconds, but if you need the entity on the very first event, consider deferring your initial tracking calls until the tracker is fully initialized.

The [bot detection enrichment](/docs/pipeline/enrichments/available-enrichments/bot-detection-enrichment/) can consolidate this client-side indicator with server-side indicators from YAUAA, IAB, and ASN lookups into a single `bot_detection` entity.
