---
title: "Advanced bot signals"
titleByFramework:
default: "Advanced bot signals"
bun: "Advanced bot signals for Bun"
deno: "Advanced bot signals for Deno"
nest-js: "Advanced bot signals for NestJS"
next-js: "Advanced bot signals for Next.js"
node-js: "Advanced bot signals for Node.js"
remix: "Advanced bot signals for Remix"
sveltekit: "Advanced bot signals for SvelteKit"
python-fastapi: "Advanced bot signals for FastAPI"
python-flask: "Advanced bot signals for Flask"
description: "Use Arcjet advanced bot signals for browser-based bot detection that identifies automation without CAPTCHAs or user challenges."
sdkDescription: "Add Arcjet advanced bot signals to your {sdk} app for browser-based bot detection that identifies automation without CAPTCHAs or user challenges."
frameworks:
- bun
- deno
- nest-js
- next-js
- node-js
- python-fastapi
- python-flask
- remix
- sveltekit
ajToc:
- text: "When to use signals"
anchor: "when-to-use-advanced-signals"
- text: "How it works"
anchor: "how-it-works"
- text: "Pricing"
anchor: "pricing"
- text: "Setup"
anchor: "setup"
children:
- text: "Step 1: Add the script"
anchor: "step-1-add-the-script"
- text: "Step 2: Configure bot detection"
anchor: "step-2-configure-bot-detection"
- text: "Step 3: Enforce with a filter rule"
anchor: "step-3-enforce-with-a-filter-rule"
- text: "Content Security Policy"
anchor: "content-security-policy"
---
import { Badge } from "@astrojs/starlight/components";
import Comments from "@/components/Comments.astro";
import { Link } from "@/components/link";
import { frameworks } from "@/lib/prefs";
import SlotByFramework from "@/components/SlotByFramework.astro";
import FrameworkLinks from "@/components/FrameworkLinks.astro";
import BunAddScript from "@/snippets/bot-protection/advanced-signals/html/AddScript.mdx";
import DenoAddScript from "@/snippets/bot-protection/advanced-signals/html/AddScript.mdx";
import NestJsAddScript from "@/snippets/bot-protection/advanced-signals/html/AddScript.mdx";
import NextJsAddScript from "@/snippets/bot-protection/advanced-signals/nextjs/AddScript.mdx";
import NodeJsAddScript from "@/snippets/bot-protection/advanced-signals/html/AddScript.mdx";
import RemixAddScript from "@/snippets/bot-protection/advanced-signals/html/AddScript.mdx";
import SvelteKitAddScript from "@/snippets/bot-protection/advanced-signals/html/AddScript.mdx";
import PythonFastapiAddScript from "@/snippets/bot-protection/advanced-signals/html/AddScript.mdx";
import PythonFlaskAddScript from "@/snippets/bot-protection/advanced-signals/html/AddScript.mdx";
import BunBlockSignals from "@/snippets/bot-protection/advanced-signals/bun/BlockSignals.mdx";
import DenoBlockSignals from "@/snippets/bot-protection/advanced-signals/deno/BlockSignals.mdx";
import NestJsBlockSignals from "@/snippets/bot-protection/advanced-signals/nestjs/BlockSignals.mdx";
import NextJsBlockSignals from "@/snippets/bot-protection/advanced-signals/nextjs/BlockSignals.mdx";
import NodeJsBlockSignals from "@/snippets/bot-protection/advanced-signals/nodejs/BlockSignals.mdx";
import RemixBlockSignals from "@/snippets/bot-protection/advanced-signals/remix/BlockSignals.mdx";
import SvelteKitBlockSignals from "@/snippets/bot-protection/advanced-signals/sveltekit/BlockSignals.mdx";
import PythonFastapiBlockSignals from "@/snippets/bot-protection/advanced-signals/python-fastapi/BlockSignals.mdx";
import PythonFlaskBlockSignals from "@/snippets/bot-protection/advanced-signals/python-flask/BlockSignals.mdx";
import BunDenySignals from "@/snippets/bot-protection/advanced-signals/shared-js/DenySignals.mdx";
import DenoDenySignals from "@/snippets/bot-protection/advanced-signals/shared-js/DenySignals.mdx";
import NestJsDenySignals from "@/snippets/bot-protection/advanced-signals/shared-js/DenySignals.mdx";
import NextJsDenySignals from "@/snippets/bot-protection/advanced-signals/shared-js/DenySignals.mdx";
import NodeJsDenySignals from "@/snippets/bot-protection/advanced-signals/shared-js/DenySignals.mdx";
import RemixDenySignals from "@/snippets/bot-protection/advanced-signals/shared-js/DenySignals.mdx";
import SvelteKitDenySignals from "@/snippets/bot-protection/advanced-signals/shared-js/DenySignals.mdx";
import PythonFastapiDenySignals from "@/snippets/bot-protection/advanced-signals/shared-py/DenySignals.mdx";
import PythonFlaskDenySignals from "@/snippets/bot-protection/advanced-signals/shared-py/DenySignals.mdx";
import BunMonitorSignals from "@/snippets/bot-protection/advanced-signals/shared-js/MonitorSignals.mdx";
import DenoMonitorSignals from "@/snippets/bot-protection/advanced-signals/shared-js/MonitorSignals.mdx";
import NestJsMonitorSignals from "@/snippets/bot-protection/advanced-signals/shared-js/MonitorSignals.mdx";
import NextJsMonitorSignals from "@/snippets/bot-protection/advanced-signals/shared-js/MonitorSignals.mdx";
import NodeJsMonitorSignals from "@/snippets/bot-protection/advanced-signals/shared-js/MonitorSignals.mdx";
import RemixMonitorSignals from "@/snippets/bot-protection/advanced-signals/shared-js/MonitorSignals.mdx";
import SvelteKitMonitorSignals from "@/snippets/bot-protection/advanced-signals/shared-js/MonitorSignals.mdx";
import PythonFastapiMonitorSignals from "@/snippets/bot-protection/advanced-signals/shared-py/MonitorSignals.mdx";
import PythonFlaskMonitorSignals from "@/snippets/bot-protection/advanced-signals/shared-py/MonitorSignals.mdx";
import BunFilterSignals from "@/snippets/bot-protection/advanced-signals/shared-js/FilterSignals.mdx";
import DenoFilterSignals from "@/snippets/bot-protection/advanced-signals/shared-js/FilterSignals.mdx";
import NestJsFilterSignals from "@/snippets/bot-protection/advanced-signals/shared-js/FilterSignals.mdx";
import NextJsFilterSignals from "@/snippets/bot-protection/advanced-signals/shared-js/FilterSignals.mdx";
import NodeJsFilterSignals from "@/snippets/bot-protection/advanced-signals/shared-js/FilterSignals.mdx";
import RemixFilterSignals from "@/snippets/bot-protection/advanced-signals/shared-js/FilterSignals.mdx";
import SvelteKitFilterSignals from "@/snippets/bot-protection/advanced-signals/shared-js/FilterSignals.mdx";
import PythonFastapiFilterSignals from "@/snippets/bot-protection/advanced-signals/shared-py/FilterSignals.mdx";
import PythonFlaskFilterSignals from "@/snippets/bot-protection/advanced-signals/shared-py/FilterSignals.mdx";
import BunFilterDecision from "@/snippets/bot-protection/advanced-signals/shared-js/FilterDecision.mdx";
import DenoFilterDecision from "@/snippets/bot-protection/advanced-signals/shared-js/FilterDecision.mdx";
import NestJsFilterDecision from "@/snippets/bot-protection/advanced-signals/shared-js/FilterDecision.mdx";
import NextJsFilterDecision from "@/snippets/bot-protection/advanced-signals/nextjs/FilterDecision.mdx";
import NodeJsFilterDecision from "@/snippets/bot-protection/advanced-signals/shared-js/FilterDecision.mdx";
import RemixFilterDecision from "@/snippets/bot-protection/advanced-signals/shared-js/FilterDecision.mdx";
import SvelteKitFilterDecision from "@/snippets/bot-protection/advanced-signals/shared-js/FilterDecision.mdx";
import PythonFastapiFilterDecision from "@/snippets/bot-protection/advanced-signals/shared-py/FilterDecision.mdx";
import PythonFlaskFilterDecision from "@/snippets/bot-protection/advanced-signals/shared-py/FilterDecision.mdx";
Some bots run a real browser, such as headless Chrome driven by Playwright or
Puppeteer, and look like a person to your server. Arcjet advanced bot signals
detect these bots in the browser: a WebAssembly module runs checks on the
browser environment to detect automation, stores the result in the
`aj_signals` cookie, and the `detectBot` rule evaluates it on your server.
A failed check gives the request a bot identity with kind `AUTOMATION` and
`FINGERPRINT` evidence. For how advanced signals fit with the other layers of
bot protection, see Block malicious bots.
## When to use advanced signals
Advanced signals is ideal for detecting bots that execute JavaScript and interact with the page
like a real user, such as headless browsers and sophisticated scrapers. It can identify
automation that mimics human behavior and evades simpler bot detection methods.
Arcjet advanced bot signals works best on sensitive routes where you want to be
sure the request comes from a real browser. Examples include form `POST`
handlers, login and signup endpoints, and other routes that are common targets
for abuse.
It sets a cookie to identify the browser, and stores the analysis results in
Arcjet's cloud. Arcjet then links the client-side signals when it evaluates
server-side bot detection rules. This approach helps detect bots without relying
on CAPTCHAs or user challenges, so legitimate users are not interrupted.
## How it works
1. A browser script loads and starts a WebAssembly-based signal collector.
2. The collector gathers signals and sends them to the Arcjet API. Arcjet then returns
a continue token, which is stored in the `aj_signals` cookie.
3. That cookie remains valid for about 15 minutes, so the collected signals can be
reused on later requests instead of being collected again on every page load.
After the cookie expires, the script collects signals again on the next page load.
4. On the next request, the browser sends the `aj_signals` cookie. An Arcjet `detectBot`
rule can then read it server-side, for example in a form `POST` handler.
5. If the signals suggest automation, or if the cookie holds a token that is
invalid, expired, or unknown, Arcjet denies the request and includes
`ARCJET_SIGNALS` as the denial reason. A missing cookie isn't a signal on its
own, so `detectBot` doesn't deny a request for it. To require the cookie, use
the filter rule in [Step 3](#step-3-enforce-with-a-filter-rule).
## Pricing
Arcjet advanced bot signals are charged based on usage. For details, see the [pricing page](https://arcjet.com/pricing).
## Setup
### Step 1: Add the script
!frontmatter.frameworks.includes(d.key))
.map((d) => d.key)}
title="Choose a framework"
/>
Load the signals script on every page that might lead into a sensitive route, such as a lead or signup form. That way, the `aj_signals` cookie is set before the user reaches the protected endpoint through a form submission.
We recommend adding the script to every page. Usage billing is based on when you call the `detectBot` rule, not on when the script runs, so you aren't charged for loading the script.
The script evaluates the browser environment and sets the `aj_signals` cookie,
which is then read server-side by `detectBot`.
### Step 2: Configure bot detection
Use a [`detectBot` rule](/bot-protection/quick-start) to act on signals results. Signals is most useful on sensitive
routes such as form `POST` handlers, login, and signup endpoints – routes where
you care whether the request comes from a real browser.
#### Block when signals fails (recommended for sensitive routes)
With an empty `allow` list, all detected bots are denied – including requests
that fail signals evaluation. This is the recommended configuration for
high-sensitivity endpoints:
If the result indicates automation, the request is denied with `ARCJET_SIGNALS`
in the denial reason. You can see this in your logs and in the [Arcjet Console](https://console.arcjet.com).
:::note
A bot or AI agent that you allow by name and that sends a verified Web Bot Auth
signature skips the signals check. For details, see How a verified signature changes the decision.
:::
#### Deny signals explicitly
To block signals failures alongside other specific identifiers, add
`ARCJET_SIGNALS` to the `deny` list. With a `deny` list, only the listed
identifiers are blocked – any bot not in the list is allowed:
#### Monitor without blocking
To collect signals data without blocking, add `ARCJET_SIGNALS` to the `allow`
list. Signals are still evaluated but the result does not affect the decision:
### Step 3: Enforce with a filter rule
Once you install the signals script, the `aj_signals` cookie is set for any
browser that loads it. If a request is missing the cookie, that is a strong
signal that the client is not a real browser. Examples include a bot that
doesn't execute JavaScript and a scraper that targets your API directly.
You can enforce the cookie by using a [filter rule](/filters) to block any request.
The expression `len(http.request.cookie["aj_signals"]) eq 0` matches any
request where the cookie is missing or empty, and the `deny` list causes
those requests to be blocked before `detectBot` is even evaluated. You can
combine this with a `detectBot` rule to layer both checks on the same route.
### Handle the filter decision
When a filter rule denies a request, `decision.reason.isFilter()` returns
`true`. This lets you distinguish a missing-cookie denial from a bot detection
denial and return a more helpful response. For example, you can redirect the user
to an error page that explains cookies are required, rather than returning a
silent 403:
## Content Security Policy
If your application sets a Content Security Policy (CSP), add the following
directives to allow the signals script to load and run:
| Directive | Value | Reason |
| ------------ | --------------------------------------------------------- | ----------------------------------------------------------------- |
| `script-src` | `https://signals-cdn.arcjet.com` | Loads the signals JavaScript and WebAssembly module from the Arcjet CDN |
| `script-src` | `'wasm-unsafe-eval'` | Required to execute the WebAssembly module |
| `connect-src`| `https://signals-cdn.arcjet.com` | Fetches assets from the Arcjet CDN at runtime |
| `connect-src`| `https://signals.arcjet.com` | Sends collected signals to the Arcjet API |
| `frame-src` | `https://signals-cdn.arcjet.com` | Allows collecting signals from different contexts |
### Use Nosecone
[Nosecone](/nosecone/quick-start) is a library for setting secure HTTP
headers, including CSP, in Next.js middleware and other frameworks. If you're
already using nosecone, extend the default directives to include the signals
URLs:
```ts title="middleware.ts"
import * as nosecone from "@nosecone/next";
const noseconeConfig: nosecone.Options = {
...nosecone.defaults,
contentSecurityPolicy: {
...nosecone.defaults.contentSecurityPolicy,
directives: {
...nosecone.defaults.contentSecurityPolicy.directives,
scriptSrc: [
...nosecone.defaults.contentSecurityPolicy.directives.scriptSrc,
"https://signals-cdn.arcjet.com",
"'wasm-unsafe-eval'",
],
connectSrc: [
...nosecone.defaults.contentSecurityPolicy.directives.connectSrc,
"https://signals-cdn.arcjet.com",
"https://signals.arcjet.com",
],
frameSrc: [
"https://signals-cdn.arcjet.com",
],
},
},
};
export default nosecone.createMiddleware(noseconeConfig);
```