Troubleshooting · Content Security Policy

Fix Content Security Policy errors that block the Admaxxer pixel

Short version: add the origin the pixel uses to both script-src and connect-src in your existing policy. For the standard install that's https://admaxxer.com; with a first-party tracking domain it's your tracking subdomain. If your site doesn't send a Content Security Policy, this isn't your problem.

Two directives · Standard and first-party installs

What the pixel needs your policy to allow

The pixel is a single external script. It loads from one origin and sends all of its requests (events, batched events and identify calls) back to that same origin. It doesn't load other scripts, images, frames or fonts, so only two directives matter: script-src for the script and connect-src for the requests.

How you installed the pixelAllow in script-srcAllow in connect-src
Standard snippet (https://admaxxer.com/js/script.js or another script from admaxxer.com)https://admaxxer.comhttps://admaxxer.com
First-party tracking domain, such as t.yourbrand.comhttps://t.yourbrand.comhttps://t.yourbrand.com
Your own proxy, served from the same host as your pages'self''self'

'self' covers only your page's own host

On www.yourbrand.com, 'self' does not cover t.yourbrand.com or any other subdomain. If the pixel loads from a different subdomain, whether a tracking domain or a proxy on another host, list that subdomain explicitly.

Step 1: Confirm the policy is the cause

  1. Open your site and your browser's developer tools, then reload the page.
  2. In the Console, look for an error that mentions Content Security Policy and names the pixel's script or event address.
  3. In the Network tab, filter for script or event. Chrome lists a request your policy blocked with the status (blocked:csp).

Typical console messages (exact wording varies by browser)

Refused to load the script 'https://admaxxer.com/js/script.js' because it violates the following Content Security Policy directive: "script-src 'self'".

Refused to connect to 'https://admaxxer.com/api/event' because it violates the following Content Security Policy directive: "connect-src 'self'".

If Chrome shows the request failing with net::ERR_BLOCKED_BY_CLIENT instead, that's a browser extension such as an ad blocker, not your policy. A first-party tracking domain helps with that.

Step 2: Find where your policy is set

To see the header, run curl -sI https://yourdomain.com | grep -i content-security-policy. A meta-tag policy won't show up there, so also check your page source.

Step 3: Add the pixel's origin

Add the origin to your existing policy. Don't replace your policy with a two-line one: anything you leave out, including your own scripts, would then be blocked.

Before

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

After (standard install)

Content-Security-Policy: default-src 'self'; script-src 'self' https://admaxxer.com; connect-src 'self' https://admaxxer.com

Next.js

next.config.js

module.exports = {
  async headers() {
    return [
      {
        source: '/(.*)',
        headers: [
          {
            key: 'Content-Security-Policy',
            value: "default-src 'self'; script-src 'self' https://admaxxer.com; connect-src 'self' https://admaxxer.com",
          },
        ],
      },
    ];
  },
};

NGINX

add_header Content-Security-Policy "default-src 'self'; script-src 'self' https://admaxxer.com; connect-src 'self' https://admaxxer.com" always;

Apache

.htaccess

Header set Content-Security-Policy "default-src 'self'; script-src 'self' https://admaxxer.com; connect-src 'self' https://admaxxer.com"

Rails

config/initializers/content_security_policy.rb

Rails.application.config.content_security_policy do |policy|
  policy.script_src  :self, 'https://admaxxer.com'
  policy.connect_src :self, 'https://admaxxer.com'
end

These examples show a minimal policy so the change is easy to see. Keep every other source and directive your site already uses. With a first-party tracking domain, use your tracking subdomain in place of https://admaxxer.com.

Step 4: Confirm the fix

  1. Reload your site. The Content Security Policy errors should be gone from the Console.
  2. In the Network tab, the pixel script and the event requests should complete instead of showing (blocked:csp).
  3. Open Dashboard → Pixel. The Live Visitors card counts pageviews from the last five minutes and refreshes every 10 seconds.

Still blocked?

Frequently asked questions

Q: Do I need 'unsafe-inline' for the pixel?

Not for the standard snippet: it's a single external script tag. If you call admaxxer(…) from inline script on your own pages, that code follows your policy like any other inline script.

Q: Do I need to change img-src, frame-src or font-src?

No. The pixel only loads one script and sends requests back to the same origin, so script-src and connect-src are all it needs.

Q: I use a first-party tracking domain. What should I allow?

Your tracking subdomain, for example https://t.yourbrand.com, in both script-src and connect-src. 'self' doesn't cover it unless your pages are served from that exact host.

Q: Where can I copy the directives from inside Admaxxer?

Open your site settings and go to the Install tab. The Content Security Policy (CSP) card has copy buttons for both directives.