UserProof / Free tools / CSP generator
CSP generator for analytics and replay scripts, for founders who build with a coding agent
A Content Security Policy (CSP) lists the hosts your page may load scripts from and send data to, so an analytics or session replay script stops working until its hosts are on the list. For founders who build with a coding agent such as Claude Code, Codex or Cursor: pick your tools below, copy the header, and hand it to your agent to add to your server or vercel.json.
Make the header
Example result Tools: UserProof, Google Analytics 4 (Google tag), PostHog · inline snippets carry a nonce
Your Content-Security-Policy header
Content-Security-Policy: default-src 'self'; script-src 'self' https://ingest.getuserproof.com https://www.googletagmanager.com 'nonce-RANDOM_PER_RESPONSE' https://*.posthog.com; img-src 'self' https://www.googletagmanager.com https://*.google-analytics.com; connect-src 'self' https://ingest.getuserproof.com https://www.googletagmanager.com https://*.google-analytics.com https://*.google.com https://*.posthog.com; worker-src 'self' blob: data:; frame-ancestors 'none'
Replace RANDOM_PER_RESPONSE with a new random value on every response, and put the same value in nonce="..." on your inline snippet.
What was added, and for which tool
| Directive | Source added |
|---|---|
script-src | https://ingest.getuserproof.com UserProofhttps://www.googletagmanager.com Google Analytics 4 (Google tag)'nonce-RANDOM_PER_RESPONSE' Google Analytics 4 (Google tag)https://*.posthog.com PostHog |
img-src | https://www.googletagmanager.com Google Analytics 4 (Google tag)https://*.google-analytics.com Google Analytics 4 (Google tag) |
connect-src | https://ingest.getuserproof.com UserProofhttps://www.googletagmanager.com Google Analytics 4 (Google tag)https://*.google-analytics.com Google Analytics 4 (Google tag)https://*.google.com Google Analytics 4 (Google tag)https://*.posthog.com PostHog |
worker-src | blob: PostHogdata: PostHog |
The same in vercel.json
{
"headers": [
{
"source": "/(.*)",
"headers": [
{
"key": "Content-Security-Policy",
"value": "default-src 'self'; script-src 'self' https://ingest.getuserproof.com https://www.googletagmanager.com 'nonce-RANDOM_PER_RESPONSE' https://*.posthog.com; img-src 'self' https://www.googletagmanager.com https://*.google-analytics.com; connect-src 'self' https://ingest.getuserproof.com https://www.googletagmanager.com https://*.google-analytics.com https://*.google.com https://*.posthog.com; worker-src 'self' blob: data:; frame-ancestors 'none'"
}
]
}
]
}The same for nginx
add_header Content-Security-Policy "default-src 'self'; script-src 'self' https://ingest.getuserproof.com https://www.googletagmanager.com 'nonce-RANDOM_PER_RESPONSE' https://*.posthog.com; img-src 'self' https://www.googletagmanager.com https://*.google-analytics.com; connect-src 'self' https://ingest.getuserproof.com https://www.googletagmanager.com https://*.google-analytics.com https://*.google.com https://*.posthog.com; worker-src 'self' blob: data:; frame-ancestors 'none'" always;
Ship it first as Content-Security-Policy-Report-Only, load your pages, and read the console for blocked requests before you enforce it.
How to read the result
The header line is your current policy with every source the ticked tools need added to it. Nothing you already had is removed, except 'none' in a directive that now has to allow a host. The table under it says which tool asked for each new source, so you can drop a tool later without guessing.
When the generator creates a directive your policy didn't have, it starts it with your default-src sources (minus 'none'). That matters: once script-src exists, the browser stops using default-src for scripts, so a new script-src without 'self' would block your own files. If your policy has no default-src at all, a directive you never set allows everything, so the generator leaves it unset and says so. If you already use script-src-elem or style-src-elem, the hosts go there too.
In nonce mode the header holds 'nonce-RANDOM_PER_RESPONSE'. Your server must swap that for a fresh random value on every response and put the same value on each inline snippet (<script nonce="...">). Browsers ignore 'unsafe-inline' in any directive that also holds a nonce or hash, so in nonce mode the generator leaves it out of script-src. Hotjar's 'unsafe-inline' for styles stays, because styles carry no nonce here.
What 371 YC startup homepages send
We read the home page of every company in our YC homepage benchmark on November 17, 2026: 376 sites, of which 371 answered. We fetched each with a Chrome user agent and read the Content-Security-Policy header, or a CSP meta tag in the page.
| What the home page sends | Sites | Share |
|---|---|---|
| An enforced CSP (header or meta tag) | 99 | 27% of 371 |
| A CSP with a script rule (script-src or default-src) | 62 | 17% of 371 |
| A CSP with no script rule (only frame-ancestors, upgrade-insecure-requests and the like) | 37 | of the 99 |
| A script rule that allows 'unsafe-inline' | 43 | 69% of 62 |
| A script rule with a nonce, hash or 'strict-dynamic' | 12 | of 62 |
| Only a report-only policy, nothing enforced | 5 | of 371 |
| The CSP in a meta tag only | 3 | of the 99 |
| The Google tag (gtag.js) in the page HTML | 94 | 25% of 371 |
Source: UserProof, 371 YC startup homepages from our YC homepage benchmark, read November 17, 2026 (scripts/yc-csp-scan.py, data/yc-csp-2026-11-17.json). The script rule is script-src, else default-src. A page that loads its scripts after the first HTML can carry tags we didn't see.
So about 1 in 6 of these startups controls which scripts its home page runs, and two thirds of those still allow inline scripts. If your policy is like the 37 of the 99 with no script rule, adding analytics needs no CSP change at all, and adding a script rule is the bigger step.
What each tool needs, side by side
| Tool | script-src | connect-src | Other directives | worker-src | Inline snippet in the install | Vendor page |
|---|---|---|---|---|---|---|
| UserProof | https://ingest.getuserproof.com | https://ingest.getuserproof.com | none listed | none listed | no | read November 17, 2026 |
| Google Analytics 4 (Google tag) | https://www.googletagmanager.com | https://www.googletagmanager.com https://*.google-analytics.com https://*.google.com | img-src: https://www.googletagmanager.com https://*.google-analytics.com | none listed | yes | page updated 2026-11-10 |
| PostHog | https://*.posthog.com | https://*.posthog.com | none listed | 'self' blob: data: | yes, unless installed from npm | no date shown |
| Sentry (with Session Replay) | https://browser.sentry-cdn.com https://js.sentry-cdn.com | *.sentry.io | child-src: 'self' blob: | 'self' blob: | no | no date shown |
| Hotjar | https://*.hotjar.com 'unsafe-inline' | https://*.hotjar.com https://*.hotjar.io wss://*.hotjar.com | img-src: https://*.hotjar.comstyle-src: https://*.hotjar.com 'unsafe-inline'font-src: https://*.hotjar.com | none listed | yes | updated 2026-10-16 |
| Microsoft Clarity | https://*.clarity.ms https://c.bing.com | https://*.clarity.ms https://c.bing.com | img-src: https://*.clarity.ms https://c.bing.com | none listed | yes | page shows Last updated 2025-08-13 |
| FullStory (US) | https://edge.fullstory.com https://rs.fullstory.com | https://edge.fullstory.com https://rs.fullstory.com | img-src: https://rs.fullstory.com | blob: | yes | updated 2026-11-13 |
| FullStory (EU) | https://edge.eu1.fullstory.com https://rs.eu1.fullstory.com | https://edge.eu1.fullstory.com https://rs.eu1.fullstory.com | img-src: https://rs.eu1.fullstory.com | blob: | yes | updated 2026-11-13 |
| LogRocket | 12 hosts, cdn.logrocket.io to cdn.logr-in.com (all in the generator) | 13 wildcards, *.logrocket.io to *.logr-in.com | child-src: 'self' blob: | 'self' blob: | yes, unless installed from npm | updated 2026-08-31 |
| Mouseflow | *.mouseflow.com | *.mouseflow.com | img-src: *.mouseflow.comfont-src: *.mouseflow.comframe-src: *.mouseflow.comchild-src: *.mouseflow.com | none listed | yes | June 13, 2024 |
| Lucky Orange | https://tools.luckyorange.com | https://*.luckyorange.com https://pubsub.googleapis.com wss://*.visitors.live | none listed | blob: | yes | updated 2026-10-20 |
| Smartlook | https://*.smartlook.com https://*.smartlook.cloud | https://*.smartlook.com https://*.smartlook.cloud | none listed | none listed | yes | updated 2025-09-11 |
Each row copied from the vendor's own page on November 17, 2026; the date in the last column is the date the page shows. Hosts as the vendor writes them (Mouseflow and Sentry write theirs without https://).
| Tool | What the vendor's page adds |
|---|---|
| UserProof | One external script tag; it sends to the origin it loaded from. No inline snippet, no worker, no styles or fonts. If you set data-api, allow that origin in connect-src instead. |
| Google Analytics 4 (Google tag) | Google's rows for Analytics without Ads features. Google writes script-src-elem; script-src covers script elements too. With Google signals or Ads, Google lists more hosts, one per Google country domain. |
| PostHog | PostHog recommends the wildcard because its subdomains can change. If you send through a reverse proxy, allow your proxy's origin instead. The toolbar needs more (img, style, font, media). |
| Sentry (with Session Replay) | Script and connect hosts are from Sentry's Loader Script page; an SDK bundled from npm needs no script host. connect-src must hold your DSN's origin; Sentry's example is *.sentry.io. The Session Replay page adds worker-src 'self' blob: (compression runs in a worker) and child-src 'self' blob: for Safari 15.4 and older. |
| Hotjar | Hotjar's recommended set. It lists 'unsafe-inline' for scripts and styles, and a wss: socket. |
| Microsoft Clarity | Microsoft gives one default-src line (https://*.clarity.ms https://c.bing.com 'unsafe-inline'). We put those hosts in the three directives a tag uses; if Clarity still fails, use Microsoft's line. |
| FullStory (US) | EU organizations use edge.eu1.fullstory.com and rs.eu1.fullstory.com instead (the next row). FullStory says capture continues if the worker is blocked. |
| FullStory (EU) | The same rules for an organization on FullStory's EU data center. |
| LogRocket | 12 script hosts and 13 connect hosts. LogRocket warns that worker-src is not supported in Safari before 15.5. |
| Mouseflow | Mouseflow lists one wildcard, *.mouseflow.com, with no scheme, in six directives. |
| Lucky Orange | The heatmap tool also needs https://storage.googleapis.com/lucky-orange-public/heatmaps2/ in script-src; chat, surveys and live visitors may need wss://realtime.luckyorange.com/mqtt. |
| Smartlook | Smartlook says the wildcards are required and advises a nonce or hash for its inline snippet rather than 'unsafe-inline'. |
| Tool | Sources to add | Directives touched | Inline snippet | Needs blob: |
|---|---|---|---|---|
| UserProof | 2 | 2 | no | no |
| Google Analytics 4 (Google tag) | 6 | 3 | yes | no |
| PostHog | 5 | 3 | yes | yes |
| Sentry (with Session Replay) | 7 | 4 | no | yes |
| Hotjar | 9 | 5 | yes | no |
| Microsoft Clarity | 6 | 3 | yes | no |
| FullStory (US) | 6 | 4 | yes | yes |
| LogRocket | 29 | 4 | yes | yes |
| Mouseflow | 6 | 6 | yes | no |
| Lucky Orange | 5 | 3 | yes | yes |
| Smartlook | 4 | 2 | yes | no |
LogRocket asks for the most (29 sources in 4 directives); UserProof asks for 2 in 2. 5 of the tools need blob: in worker-src because they run part of the recorder in a worker: PostHog, Sentry, FullStory, LogRocket, Lucky Orange.
Worked example: UserProof, Google Analytics and PostHog on a small SaaS site
The form above opens on this case: a site that sends default-src 'self'; frame-ancestors 'none' and wants UserProof, Google Analytics 4 and PostHog, with the gtag snippet carrying a nonce. The result:
Content-Security-Policy: default-src 'self'; script-src 'self' https://ingest.getuserproof.com https://www.googletagmanager.com 'nonce-RANDOM_PER_RESPONSE' https://*.posthog.com; img-src 'self' https://www.googletagmanager.com https://*.google-analytics.com; connect-src 'self' https://ingest.getuserproof.com https://www.googletagmanager.com https://*.google-analytics.com https://*.google.com https://*.posthog.com; worker-src 'self' blob: data:; frame-ancestors 'none'
Three directives are new (script-src, img-src, connect-src) plus worker-src for PostHog's replay worker, and each starts with 'self' copied from default-src. frame-ancestors 'none' is kept as it was. The same two tools with Hotjar instead of PostHog show the nonce trade-off:
| Inline mode | Header for UserProof and Hotjar |
|---|---|
| Nonce | default-src 'self'; script-src 'self' https://ingest.getuserproof.com https://*.hotjar.com 'nonce-RANDOM_PER_RESPONSE'; style-src 'self' https://*.hotjar.com 'unsafe-inline'; img-src 'self' https://*.hotjar.com; font-src 'self' https://*.hotjar.com; connect-src 'self' https://ingest.getuserproof.com https://*.hotjar.com https://*.hotjar.io wss://*.hotjar.com |
| 'unsafe-inline' | default-src 'self'; script-src 'self' https://ingest.getuserproof.com https://*.hotjar.com 'unsafe-inline'; style-src 'self' https://*.hotjar.com 'unsafe-inline'; img-src 'self' https://*.hotjar.com; font-src 'self' https://*.hotjar.com; connect-src 'self' https://ingest.getuserproof.com https://*.hotjar.com https://*.hotjar.io wss://*.hotjar.com |
This site, getuserproof.com, sends script-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net https://datafa.st https://ingest.getuserproof.com: its free tools run inline scripts, so it sits with the 43, not the 12.
What it can't do
- It doesn't fetch your site. Paste the header you send today; your browser's network tab shows it on the page's first request. To see what that header blocks before you change it, use the CSP checker; to turn the violation reports it sends into the fix, the CSP report reader.
- It covers the base install of each tool. Toolbars, surveys, chat, heatmap editors and ad features ask for more hosts; each vendor's page in the table lists them.
- It doesn't make the nonce. Your server or framework middleware has to create one per response and add it to each inline script.
- Vendors change hosts. Every row carries the date we read it; check the vendor page if a request is still blocked.
Where UserProof fits
UserProof records real visits with one external script tag and hands your coding agent the one fix to make, with the file and line. For a CSP that means two sources and nothing inline: https://ingest.getuserproof.com in script-src and connect-src. Field values are never recorded. Free covers 3 sites and 5,000 recorded visits a month; Pro is $29 a month for 50,000. See pricing, whether session replay slows a site and the masking snippet generator for the other half of a privacy setup.
Sources, read November 17, 2026
- UserProof: public/sdk.js in the UserProof repository (API base = the script's origin) and the policy getuserproof.com serves (read November 17, 2026; read November 17, 2026).
- Google Analytics 4 (Google tag): Google tag platform: Use a Content Security Policy (page updated 2026-11-10; read November 17, 2026).
- PostHog: PostHog docs: Content Security Policy (no date shown; read November 17, 2026); PostHog docs: JavaScript web install (the inline HTML snippet).
- Sentry (with Session Replay): Sentry docs: Loader Script (script-src and connect-src) (no date shown; read November 17, 2026); Sentry docs: Session Replay, Content Security Policy (worker-src and child-src).
- Hotjar: Hotjar help: Content Security Policies (updated 2026-10-16; read November 17, 2026).
- Microsoft Clarity: Microsoft Learn: Clarity Content Security Policy (page shows Last updated 2025-08-13; read November 17, 2026).
- FullStory (US): FullStory help: Can I use Content Security Policy (CSP) with Fullstory? (updated 2026-11-13; read November 17, 2026).
- LogRocket: LogRocket docs: Session Recording Issues, Due to a Content Security Policy (updated 2026-08-31; read November 17, 2026); LogRocket docs: Quickstart (LogRocket.init in the page).
- Mouseflow: Mouseflow help: Content Security Policy (CSP) (June 13, 2024; read November 17, 2026).
- Lucky Orange: Lucky Orange developer docs: Content Security Policy (updated 2026-10-20; read November 17, 2026).
- Smartlook: Smartlook help: Content Security Policy (CSP) (updated 2025-09-11; read November 17, 2026).
- MDN: Content-Security-Policy on fallback from default-src and the meta tag's limits.
- UserProof: 371 YC startup homepages read November 17, 2026, data/yc-csp-2026-11-17.json.
Cite this
UserProof, "CSP generator for analytics and session replay scripts," https://getuserproof.com/csp-generator; vendor hosts read from each vendor's CSP page and 371 YC startup homepages read on November 17, 2026.
FAQ
What is a CSP generator?
A tool that writes a Content-Security-Policy header for you. This one starts from your current policy, adds the hosts each analytics or session replay script needs, copied from the vendor's own CSP docs, and prints the header, a vercel.json block and a line for nginx.
Why does my analytics or session replay script break after I add a CSP?
The browser blocks any script, request or worker the policy doesn't list. A recorder needs its script host in script-src and its upload host in connect-src, and several also need blob: in worker-src for compression. The browser console names each blocked URL.
Do I need 'unsafe-inline' for Google Analytics?
No. Google's CSP guide recommends a nonce or hash on the inline gtag snippet and 'unsafe-inline' only when neither is possible. Of the 62 YC homepages we read with a script rule, 43 allowed 'unsafe-inline'.
What does UserProof need in a CSP?
Two sources: https://ingest.getuserproof.com in script-src and in connect-src. It is one external script tag with no inline snippet, no worker and no styles or fonts, so it needs no 'unsafe-inline' and no blob:.
Should I use Content-Security-Policy-Report-Only first?
Yes. Send the new policy as Content-Security-Policy-Report-Only, browse your key pages, fix what the console reports as blocked, then switch the header name to Content-Security-Policy. 5 of the YC homepages we read sent only a report-only policy.
Why does adding script-src block my own scripts?
Once script-src exists, the browser stops falling back to default-src for scripts. If your policy only had default-src 'self', a new script-src must start with 'self' too. The generator copies your default-src sources into every directive it creates for that reason.
Can I put the policy in a meta tag instead?
Mostly. A <meta http-equiv="Content-Security-Policy"> tag works for script-src, connect-src and the rest, but browsers ignore frame-ancestors and reporting in a meta tag. 3 of the 99 YC homepages with a policy used a meta tag only.