# Content Security Policy

> The exact script-src and connect-src entries the Venbit tracker needs, with header, meta tag, nonce and proxy examples, and how to spot a block.

Source: https://venbit.com/docs/developer-guide/content-security-policy
Part of the Venbit Intelligence docs (Developer Guide). Index of every page: https://venbit.com/docs/llms.txt
Last updated: 2026-11-30

On a site with a Content Security Policy, the Venbit tracker needs two hosts allowed: `https://vnbt.app` and `https://venbit.com` in `script-src`, and `https://venbit.com` in `connect-src`. Leave them out and the browser blocks the tracker. Nothing gets counted, and the page shows no visible error.

```text
Content-Security-Policy: default-src 'self'; script-src 'self' https://vnbt.app https://venbit.com; connect-src 'self' https://venbit.com
```

Add the Venbit entries to the policy you already have. Don't swap your policy for this one.

A coding agent can find your policy and add the entries for you:

```prompt
Update this site's Content Security Policy for the Venbit tracker. Find where the policy is set (server config, vercel.json, next.config, middleware or a meta tag). Add https://vnbt.app and https://venbit.com to script-src and https://venbit.com to connect-src, keeping every existing entry. If the policy uses nonces, put the nonce on the vnbt.app/m.js tag and also allow https://venbit.com in script-src or add 'strict-dynamic'. Show me the diff.
```

## What each entry is for

| Directive | Value | Why |
| --- | --- | --- |
| `script-src` | `https://vnbt.app` | The file in your install line. |
| `script-src` | `https://venbit.com` | The tracker loads its current copy from here. |
| `connect-src` | `https://venbit.com` | Visits are posted here. The tracker also asks here for the site's settings. |
| `connect-src` | `'self'` | On a page that looks like an error page, the tracker asks your own server whether the address is a real 404. |

**What the tracker loads and where it posts, with the directive that has to allow each**

1. Your page (The install line)
2. https://vnbt.app (script-src. The file in your install line)
3. https://venbit.com (script-src. The tracker's current copy)
4. https://venbit.com (connect-src. Visits are posted here)

That's all the tracker needs. It loads no images, frames, fonts or stylesheets, runs no inline script and never calls `eval`, so `img-src`, `frame-src`, `font-src` and `style-src` need no entry for it.

Older install lines that load `https://venbit.com/m.js` only need `https://venbit.com` in both directives.

## Set it as a header

Send the policy from your server or host. The same policy for the common ones looks like this:

```nginx
add_header Content-Security-Policy "default-src 'self'; script-src 'self' https://vnbt.app https://venbit.com; connect-src 'self' https://venbit.com" always;
```

```apache
Header always set Content-Security-Policy "default-src 'self'; script-src 'self' https://vnbt.app https://venbit.com; connect-src 'self' https://venbit.com"
```

```json
{
  "headers": [
    {
      "source": "/(.*)",
      "headers": [
        {
          "key": "Content-Security-Policy",
          "value": "default-src 'self'; script-src 'self' https://vnbt.app https://venbit.com; connect-src 'self' https://venbit.com"
        }
      ]
    }
  ]
}
```

The JSON goes in `vercel.json`. For the Apache line you'll need `mod_headers`.

## Set it as a meta tag

If you can't set headers, a meta tag works for these two directives. Put it in the `<head>` before the install line.

```html
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' https://vnbt.app https://venbit.com; connect-src 'self' https://venbit.com">
<script defer crossorigin="anonymous" src="https://vnbt.app/m.js?s=KEY" data-site="KEY"></script>
```

## Use a nonce

The install line takes a `nonce` like any other script tag.

```html
<script defer crossorigin="anonymous" nonce="rAnd0mPerRequest" src="https://vnbt.app/m.js?s=KEY" data-site="KEY"></script>
```

That nonce only covers the one tag. Once running, the tracker adds a second script tag of its own from `https://venbit.com`, and that tag carries no nonce. So a nonce policy also needs one of these:

```text
Content-Security-Policy: script-src 'nonce-rAnd0mPerRequest' https://venbit.com; connect-src 'self' https://venbit.com
```

```text
Content-Security-Policy: script-src 'nonce-rAnd0mPerRequest' 'strict-dynamic'; connect-src 'self' https://venbit.com
```

The first allows the second script by host. With the other, `'strict-dynamic'` lets a script you trusted through its nonce load further scripts. Generate a fresh nonce for every response.

## With the first-party proxy

Through the [first-party proxy](https://venbit.com/docs/md/developer-guide/first-party-proxy.md), the script loads from your own domain and visits post back to your own domain. The browser sends nothing to Venbit, so `'self'` covers it.

```text
Content-Security-Policy: default-src 'self'; script-src 'self'; connect-src 'self'
```

The Site Agent is the exception. Even on a proxied install it loads from `https://venbit.com`.

## If the Site Agent is on

Once the owner switches the [Site Agent](https://venbit.com/docs/md/site-agent/overview.md) on, the tracker adds the agent's script from `https://venbit.com/site-agent/`. Your existing `script-src` entry already covers that first file. After that the agent pulls in its own stylesheet, an animation file, a WebAssembly file and a microphone worklet from `https://venbit.com/site-agent/`, and it talks to `https://venbit.com`.

A chat widget with voice asks more of a policy than the tracker does. Roll it out in report-only mode first and read what the browser reports before you enforce anything:

```text
Content-Security-Policy-Report-Only: default-src 'self'; script-src 'self' https://vnbt.app https://venbit.com; connect-src 'self' https://venbit.com
```

Report-only mode blocks nothing. Anything the policy would have blocked shows up in the console, and you keep adding entries until the agent opens, answers and (if you use voice) listens without a single report.

## If Block spam is on

Form protection (**Block spam** in Settings > Spam Prevention) talks to `https://venbit.com`. Your `connect-src` entry already covers that, so there's nothing extra to add.

## Spot a block

Open your site, open the browser's developer tools and look at the Console. A blocked tracker leaves a message close to this one (Chrome's wording, which shifts a little between versions):

```text
Refused to load the script 'https://vnbt.app/m.js?s=KEY' because it violates the following Content Security Policy directive: "script-src 'self'".
```

That means `script-src` is missing `https://vnbt.app`. If the same message names `https://venbit.com/m.js`, then `script-src` is missing `https://venbit.com`.

```text
Refused to connect to 'https://venbit.com/api/e' because it violates the following Content Security Policy directive: "connect-src 'self'".
```

Here the script loaded but its visits are blocked, so add `https://venbit.com` to `connect-src`. It's the hardest case to notice, because the tracker sits on the page and looks installed.

Firefox and Safari word the message differently but name the same directive. With no `script-src` or `connect-src` in your policy, the browser falls back to `default-src` and the message names that one.

Once you've changed the policy, reload the page and run through [Verify your install](https://venbit.com/docs/md/developer-guide/verify-your-install.md).

## Common questions

### Does the Venbit tracker need unsafe-inline or unsafe-eval?

No. The tracker runs no inline script and never calls `eval`. It also loads no images, frames, fonts or stylesheets, so `img-src`, `frame-src`, `font-src` and `style-src` need no entry for it.

### Why does the Venbit script load but no visits show up?

On a site with a Content Security Policy, check `connect-src` first. If it doesn't allow `https://venbit.com`, the browser blocks the visits and logs a "Refused to connect" message in the console, while the tracker still looks installed. Add `https://venbit.com` to `connect-src`.

### What CSP does a proxied Venbit install need?

Only `'self'`. With the first-party proxy, the script loads from your own domain and visits post to your own domain. The Site Agent is the exception, since it loads from `https://venbit.com` even on a proxied install.

### Does Venbit's Block spam need its own CSP entry?

No. Form protection talks to `https://venbit.com`, which the tracker's `connect-src` entry already covers.
