Content Security Policy and single-page apps

Technical notes for sites with a CSP or client-side navigation.

Content Security Policy: allow the AdCobalt host for scripts and connections. Detection also makes a test request to a common ad host; if your CSP blocks it, results are inconclusive more often. Example:

script-src 'self' https://*.acstatic.com https://pagead2.googlesyndication.com;
connect-src 'self' https://*.acstatic.com https://pagead2.googlesyndication.com

Single-page apps (React, Vue, Next.js and similar): the script notices client-side navigation through the History API and counts each new path as a page view. You don't need to call anything.

For developers: the script exposes window.adcobalt and fires an adcobalt:ready event. Use adcobaltQueue to run code once it is ready, for example to skip ads for members.

Still stuck? Sign in and use Help & Support: it checks your setup and you can write to us from there.

Get help in your dashboard