Someone adds a live-chat widget to the site on Tuesday. The page loads, nothing looks broken, and nobody complains. Two weeks later the question comes up: why has the chat never received a single conversation? The widget never appeared. The browser refused to load its script because the site's Content Security Policy did not list the widget's domain, logged one red line in a console nobody opens, and carried on. No error page, no alert, no ticket. That silence is the defining feature of this problem, and it is why marketing and development teams keep rediscovering it.

At NetWebMedia this is not theoretical. Our own site has enforced a Content Security Policy since April 2026, and the rule we wrote into our deploy checklist is blunt: a new external origin that is not in the policy fails silently.

What a Content Security Policy actually does

A Content Security Policy is an HTTP response header that tells the browser which sources a page is allowed to load things from. It is one of the strongest defenses against cross-site scripting: even if an attacker manages to inject a script tag, the browser will not run code from a domain the policy does not trust.

The policy is split into directives, each covering one kind of resource. The ones that matter most for marketing tags are:

Why marketing tags are the first thing to break

A typical marketing tag is not one request. It is a small chain, and every link in the chain needs its own permission.

  1. The tag loads a script from the vendor's domain, which needs script-src.
  2. That script often loads more scripts from other domains the vendor controls, which also need script-src.
  3. It sends events back to a collection endpoint, frequently on yet another subdomain, which needs connect-src — and sometimes img-src as a fallback.
  4. If it shows anything, such as a chat window or a consent banner, it may need frame-src, style-src and font-src too.

Miss any single link and the tag partly works, which is worse than not working at all. A script that loads but cannot send its data looks perfectly installed in a tag-checker extension while your reports quietly undercount.

Tag managers make it harder, not easier

A tag manager is convenient precisely because it lets people add tags without touching the site's code. That is also exactly how it collides with a policy that lives in the site's code. Anyone with access to the container can publish a new vendor, and the policy will block it unless someone updates the header at the same time.

Custom HTML tags add a second problem. They inject inline script into the page, and a strict policy blocks inline script unless it carries a nonce or the policy includes 'unsafe-inline'. Adding 'unsafe-inline' to make the tag manager happy removes much of the protection the policy exists to provide, so treat it as a last resort rather than a quick fix. Google publishes guidance on running its tag manager under a Content Security Policy, including the nonce-based approach, and it is worth reading before you choose.

How to tell whether the policy is the culprit

When a tag misbehaves, check the policy before you blame the vendor. It takes about as long as reading this paragraph.

Adding a new tag without switching the protection off

The fix is never to delete the header. It is a small, repeatable routine every time a new vendor goes live.

  1. Before launch, read the vendor's own documentation for its CSP requirements. Most major analytics, advertising and chat vendors publish the exact domains per directive.
  2. Add those domains to the specific directives they need — script-src for the loader, connect-src for data collection, frame-src for embeds — instead of widening default-src or adding a wildcard.
  3. Deploy the updated policy first, or in the same release as the tag. Never let a tag go live on a policy that has not caught up.
  4. Load the page, open the console, and trigger the tag's real behavior: submit the test form, open the chat, play the video. Confirm the event actually arrives in the vendor's dashboard.
  5. Write the new origins down next to the name of the tag that needs them, so the next person removing that vendor knows which lines can go too.

Use report-only mode for bigger changes

Browsers also support a Content-Security-Policy-Report-Only header. It evaluates a policy without enforcing it: violations are reported, but nothing is blocked. That makes it the safe way to tighten a policy or roll one out for the first time. Run the stricter version in report-only alongside the live one, collect the violations for a while with a reporting endpoint, fix what is legitimate, and only then promote it to enforcement.

Two limits worth knowing: a policy delivered in an HTML meta tag cannot use report-only mode or reporting directives, and it does not support frame-ancestors. For anything serious, send the policy as a real HTTP header.

Make it a checklist item, not a memory

The failure here is almost never technical ignorance. It is two teams working on the same page at different speeds: marketing adds a tag this afternoon, and the policy lives in a server config that changes on a release schedule. The fix is procedural.

A Content Security Policy is one of the few security controls that costs nothing at runtime and blocks a whole class of attacks. The trade is that it makes every third-party tag an explicit decision. Treat that as a feature: if nobody can say why a domain is allowed to run code on your pages, it probably should not be.

Does your business show up when AI answers?

ChatGPT, Claude, Perplexity and Google's AI Overviews are already answering the questions your customers ask. The $49 AI Visibility Scan shows you where you're cited, where you're invisible, and the three changes that move you first — a written report in your inbox within 48 hours. If nothing in it is actionable, you don't pay.

Run the $49 AI Visibility Scan →

Or book a free 30-minute strategy call →

Share this article

X (Twitter) LinkedIn Facebook WhatsApp

Comments

Leave a comment

← Back to all articles