Short version: our Content-Security-Policy blocked an advertising pixel. The tag was in the page, the code was correct, the build was correct, and no error appeared anywhere we were looking. For four days the pixel collected no data. Now a launch check compares the CSP against the analytics tag the page loads.
What happened
The site sends a Content-Security-Policy, which is good practice. The policy did not allow the ad pixel.
From the outside everything looked fine:
- the tag was in the HTML, so "is the pixel installed?" said yes;
- the page worked for visitors;
- the build and every test passed.
The browser simply refused to load the script, and wrote one line about it in the developer console, which nobody reads on a live site. The ad platform showed no events.
It took four days to connect the missing data to the policy.
Why this class of failure is so quiet
We later counted four failures of this class on the same site, and all four were silent: an external script that looks installed, writes one console line, and collects nothing. Among the causes:
- A policy that does not allow the tag (the case above).
- A CDN that injects its own script, which the policy then blocks.
- A tracking ID read from a build-time environment variable that was empty at build time, so the tag was printed with an empty ID.
None of these produce an error a server sees. The only proof is from the outside: load the live page, read the policy, and check that the tag's script, its inline snippet and its collect endpoint are all allowed.
What we changed
- "Installed" is not evidence. Our launch standard treats analytics as proven only by a request that actually leaves the browser, or by a machine check that the policy allows everything the tag needs.
- The check reads both places a policy can live: the response header and
the
<meta>tag. - It runs against the live URL, because some layers (a CDN, a proxy) only exist there.
The general rule
Security headers and third-party tags are written by different people at different times. Every time one changes, check the other. And measure from the outside: the browser's view is the only one that counts.
What we built from it
Launch Standard is our 19-item checklist for
putting a site live, with a checker (launch-check) that measures the live
URL. Item 19 evaluates the Content-Security-Policy (header and meta) against
the analytics tag's script, inline snippet and collect endpoint, and fails if
any of them would be blocked. Items it cannot measure are marked for a human,
not passed.
Checklist for your own site
- Open your live site with the browser console open. Any CSP violation lines?
- In your analytics tool, did events stop on the day of your last header change?
- Is your tracking ID baked in at build time? Check the live HTML, not the code.
- After every CSP change, re-test every third-party tag.