Skip to the page

Developer GuidePrivacy and delivery

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.


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.

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:

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

DirectiveValueWhy
script-srchttps://vnbt.appThe file in your install line.
script-srchttps://venbit.comThe tracker loads its current copy from here.
connect-srchttps://venbit.comVisits 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

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:

Content-Security-Policy: script-src 'nonce-rAnd0mPerRequest' https://venbit.com; connect-src 'self' https://venbit.com
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, 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.

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 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:

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):

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.

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.

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.

Last updated . Something wrong or missing on this page? Tell us from Settings, then Support.