Content Security Policy for Non-Developers: A Plain-English Guide
What CSP is, why small business sites need one, and how to add basic protection in report-only mode without breaking checkout, forms, or third-party widgets.
# Content Security Policy for Non-Developers: A Plain-English Guide
If you run a small business website and you've heard the phrase "Content Security Policy" tossed around by a developer, a security scanner, or your hosting provider, you probably nodded politely and hoped it would go away. It won't. CSP is one of the most effective ways to stop a hacked site from stealing your customers' credit card numbers, hijacking your contact forms, or showing visitors fake login pages.
This guide is written for the person who owns the site, not the person who codes it. By the end, you'll know what CSP does, when you actually need it, how to add a basic one without breaking your site, and what to do when something does break.

What CSP Actually Does (in One Paragraph)
Your website loads stuff from lots of places. Your own server hosts the main pages, but Google Analytics tracks visitors, Stripe handles payments, a chat widget chats, Mailchimp captures emails, and maybe a Facebook pixel runs in the background. Each of those is a "source." A Content Security Policy is a short list of approved sources you give the browser. The browser then refuses to load anything that isn't on the list. If an attacker manages to inject a sneaky script tag onto your contact page, the browser sees the script came from a domain you never approved, and blocks it. That's the entire point.
Why a Small Business Site Needs This
You might think CSP is for banks and enterprise platforms. It isn't. The most common targets of script injection are not big companies with security teams. They are small business sites running outdated WordPress plugins, abandoned Shopify themes, or custom code written by a contractor three years ago. Attackers scan the web automatically. If your site has a known vulnerability, you will be found.
Without CSP, an attacker who finds even a tiny opening can:
- Inject a fake checkout form that captures credit card details
- Load a cryptocurrency miner that runs while customers browse
- Redirect mobile visitors to a phishing page
- Steal session cookies and impersonate logged-in users
- Replace your contact form with one that emails leads to a competitor
With a properly configured CSP, most of those attacks fail silently in the browser. The injected script tries to load, the browser checks the policy, and the load is refused.
The Two Ways CSP Gets Delivered
There are two technical ways a CSP reaches the browser, and you should know the names because your hosting support team will use them.
HTTP header: The server sends a Content-Security-Policy header with every page response. This is the preferred method.
Meta tag: A tag is added in the page's HTML head. This works for static sites or platforms where you can't easily edit headers, but it's slightly less powerful (some directives like frame-ancestors are ignored) and slightly slower, because the browser has already started parsing before it sees the rule.
Most managed platforms — Shopify, Squarespace, Webflow, modern WordPress hosts — let you set headers either through a settings panel or through a plugin. If yours doesn't, the meta-tag approach still works.
The Anatomy of a CSP, Without the Jargon
A CSP is a single line of text made up of "directives." Each directive tells the browser what's allowed for one type of resource.
Here is a beginner-friendly example for a typical small business site that uses Google Analytics, Stripe, and a Mailchimp form:
default-src 'self';
script-src 'self' https://www.googletagmanager.com https://js.stripe.com;
style-src 'self' 'unsafe-inline';
img-src 'self' https: data:;
connect-src 'self' https://www.google-analytics.com https://api.stripe.com;
frame-src https://js.stripe.com;
font-src 'self' https://fonts.gstatic.com;
Translated line by line:
default-src 'self'— By default, only allow stuff from my own domain.script-src— Allow scripts from my domain, Google Tag Manager, and Stripe.style-src— Allow stylesheets from my domain and inlineblocks (most themes need these).img-src— Allow images from my domain, any HTTPS source, and base64-encoded images.connect-src— Allow background data calls only to my domain, Google Analytics, and Stripe.frame-src— Allow embedded frames only from Stripe (their checkout iframe).font-src— Allow fonts from my domain and Google Fonts' font file server.
Read it once and the wall-of-text feeling goes away.
The Number One Reason People Avoid CSP
It breaks things. Specifically, it breaks things in invisible ways. A button that used to work stops working, and there's no popup explaining why. The form just doesn't submit. The chat widget never appears. The video stays blank.
This is why you should never deploy a strict CSP straight to your live site. There's a safer way.

The Safe Rollout: Report-Only Mode
CSP has a sibling header called Content-Security-Policy-Report-Only. When you use this version, the browser does not block anything. Instead, it notes every violation and — if you wire it up — sends a report to a URL you choose. You can run report-only mode for a week, see what would have been blocked, fix your policy, then switch to enforcement.
This is the single most important practical advice in this article. Always start in report-only mode. If you start with enforcement, you will break something, panic, and rip CSP out entirely.
A Walkthrough: Adding CSP to a Shopify Candle Store
Let's make this concrete. Imagine you run a candle shop on Shopify. You use:
- Shopify's own checkout
- Google Analytics 4
- A Klaviyo email popup
- A Yotpo review widget
- An Instagram embed on the homepage
Here's how you'd roll out CSP in five steps.
Step 1: Inventory your third parties. Open your homepage in Chrome, right-click, choose Inspect, and go to the Network tab. Reload the page. You'll see every external resource. Write down the domains: googletagmanager.com, google-analytics.com, static.klaviyo.com, staticw2.yotpo.com, cdninstagram.com, and so on. Do the same on a product page and the cart page, because each loads different things.
Step 2: Draft a report-only policy. List every domain you found under the appropriate directive. Be generous at first — you're trying to discover, not enforce.
Step 3: Deploy in report-only mode. On Shopify, you can add custom headers through the theme's using a meta tag, or via Shopify Functions on Plus. If you're not technical, use the meta tag in theme.liquid:
Step 4: Watch for a week. Visit your store. Place a test order. Submit the contact form. Open the chat widget. Subscribe to the newsletter. View it on mobile. Have a friend try from a different network. Throughout the week, check the browser console (the "Console" tab in Inspect) for messages that start with "Refused to load." Each one tells you a source you missed.
Step 5: Tighten and enforce. Once a full week passes with no surprises, change the header name from Content-Security-Policy-Report-Only to Content-Security-Policy. You're now actively protected.

Mini-Checklist: A Reasonable Starter CSP for Most Small Sites
A sane default you can paste and adjust, starting in report-only mode:
- [ ]
default-src 'self' - [ ]
script-src 'self'plus every analytics, tag manager, and payment domain you use - [ ]
style-src 'self' 'unsafe-inline'(most themes need inline styles) - [ ]
img-src 'self' https: data: - [ ]
connect-src 'self'plus the API domains your analytics and forms call - [ ]
frame-srclisting only payment processors and embed providers (YouTube, Vimeo) - [ ]
font-src 'self'plus your font CDN (usuallyfonts.gstatic.com) - [ ]
object-src 'none'(blocks Flash and other legacy plugin formats) - [ ]
base-uri 'self'(prevents attackers from changing your page's base URL) - [ ]
form-action 'self'plus any external form processor
What to Avoid Even If a Tutorial Tells You To
A few directives sound convenient but defeat the purpose of CSP. Skip these unless you have a specific reason and understand the risk.
'unsafe-inline'inscript-src— Allows any inline script, including ones an attacker injects. The single most common CSP mistake.'unsafe-eval'inscript-src— Allows theeval()function, a frequent attack vector.script-src *orscript-src https:— Allows scripts from any HTTPS domain. That's effectively no protection at all.
If a plugin requires 'unsafe-inline' to function, ask whether you actually need that plugin. There's almost always an alternative that loads external script files instead of inlining tags.
How to Read the Browser Console When Something Breaks
When CSP blocks something, the console shows a message like:
Refused to load the script 'https://example-tracker.com/track.js' because it violates the following Content Security Policy directive: "script-src 'self' https://www.googletagmanager.com".
Read it like this: "The browser refused to load example-tracker.com/track.js because my script-src rule didn't include that domain." The fix is either to add the domain (if legitimate) or to remove whatever is calling it (if not).
If you see violations from domains you don't recognize, treat that as a real signal. It may mean a theme or plugin is loading something you didn't approve — or that something malicious has already been injected and your CSP just caught it.
Reporting: Letting the Browser Tell You About Problems
You can add a report-uri (older) or report-to (newer) directive that tells the browser where to POST violation reports as JSON. Services like Report URI and Sentry accept these and aggregate them for you. For a small site this is optional but useful — it surfaces violations from visitors whose browsers you'll never see.
Common Platforms, Where the Setting Lives
- WordPress: A security plugin (Wordfence, Really Simple SSL, or HTTP Headers) that exposes a CSP field, or edit your
.htaccessor Nginx config directly. - Shopify: A meta tag in
theme.liquidfor non-Plus stores; Shopify Plus supports custom headers via Functions. - Squarespace: Limited — meta tags via Code Injection, but full header control isn't available on most plans.
- Webflow: Add a meta tag via site-wide custom code.
- Wix: Limited control; CSP support depends on plan and is partly managed by Wix.
- Custom Next.js / Node sites: Set the header directly in middleware or server config.
CSP and Site Performance
CSP itself adds essentially zero performance cost — it's a short text header. But the discipline of writing one usually improves performance as a side effect, because you end up auditing every third-party script and discovering you're still loading two analytics tools, an abandoned chat widget, and a tracking pixel from a campaign that ended last year. Cutting those speeds up your Core Web Vitals, which Google factors into both ranking and the user experience signals it considers part of helpful content. For more on the metrics themselves, see Google's Web Vitals overview.
A Final Reality Check
CSP is not a silver bullet. It does not stop attackers from logging into your admin panel with a weak password, it does not patch outdated plugins, and it does not protect against server-side compromises where the attacker can simply edit your HTML directly. It is one layer in a stack that should also include strong passwords, two-factor authentication, regular updates, HTTPS everywhere, and routine backups.
What CSP does is dramatically raise the cost of the most common automated attack — injecting a malicious script through a form, a comment, or a vulnerable plugin. For a small business that can't afford an incident, that's a meaningful win for a few hours of one-time setup.

Run a Free Check on Your Site Right Now
If you'd like to know whether your site already has a CSP header, whether it's strong or weak, and what other security headers are missing, run a free audit at FreeSiteAudit. The audit checks your security headers, scans for common vulnerabilities, and gives you a plain-English report of what to fix first. It takes about two minutes and doesn't require an account.
Head to our security headers tool and paste in your homepage URL. If you're running an online store, see our specific guidance for ecommerce sites. And if your audit flags existing CSP violations, our CSP fix guide walks you through resolving the most common ones.
Sources
- https://developers.google.com/search/docs/fundamentals/creating-helpful-content
- https://web.dev/articles/vitals
- https://developers.google.com/search/docs/appearance/structured-data/article
Check your website for free
Get an instant score and your top 3 critical issues in under 60 seconds.
Get Your Free Audit →