Skip to content
  • There are no suggestions because the search field is empty.

How to Configure Your Website's CSP Policy for Convert Experiments

Add Convert's domains to the Content Security Policy you already have, without blocking your other tools

 THIS ARTICLE WILL HELP YOU:


How CSP Affects Convert

A Content Security Policy (CSP) tells the browser which sources a page may load scripts, styles, images and frames from, and which servers it may connect to. If your site has a CSP, the browser blocks anything the policy doesn't allow, including Convert. Experiences may not show, or visitor data may not reach your reports, and the browser console shows an error saying the request violates your Content Security Policy.

Add Convert Without Breaking Your Other Tools

⚠️ Important: Add Convert's sources to your existing policy. Don't replace it.

Your policy already lists the sources your other tools need, such as analytics, chat or call tracking. If you replace a directive, or paste in an example from this article, anything you leave out stops loading.

  • Append to each directive. Add Convert's sources at the end of the directive's list and keep everything that's already there.
  • Watch for directives you don't have yet. A missing directive, such as connect-src, falls back to default-src. Once you add connect-src, default-src no longer applies to connections. Copy the sources from default-src into the new directive first, then add Convert's.
  • Edit the policy you have. Don't add a second CSP header or meta tag just for Convert. The browser enforces every policy and a request has to pass all of them, so a second policy can't unblock Convert.
  • List each directive once. If a directive appears twice in the same policy, the browser ignores the second one.
  • Have your developers review the change before it goes live.

What Convert Needs in Each Directive

Which directives you need depends on how strict your policy is and which Convert features you use. Add these sources to the matching directives:

  • script-src: add *.convertexperiments.com and https://app.convert.com. The tracking script loads from cdn-4.convertexperiments.com. Convert Signals & Heatmaps (Visitor Insights) bundles load from the same host, and geo and weather data from cdn-3.convertexperiments.com. The QA overlay and the Visual Editor load their scripts from https://app.convert.com.
  • connect-src: add *.convertexperiments.com. Convert sends metrics, logs, Signals data, settings and visitor data to {projectId}.metrics.convertexperiments.com, logs.convertexperiments.com, signals.convertexperiments.com and cdn-4.convertexperiments.com. *.convertexperiments.com covers all of them, including signals.convertexperiments.com itself.
  • img-src: add *.convertexperiments.com. Images you upload in the Visual Editor are served from cdn-3.convertexperiments.com/uf/.... If the browser can't send Convert's log data with a beacon, the script falls back to an image request to logs.convertexperiments.com.
  • style-src: add 'unsafe-inline', or use a nonce. Convert adds inline style elements for its anti-flicker and variation CSS.
  • worker-src: add blob: if you use Convert Signals & Heatmaps, because its worker runs from a blob URL.
  • frame-src: add https://app.convert.com if you use the QA overlay.

Three cases need more:

  • Previewing draft experiences: add 'unsafe-eval' to script-src. Without it, the preview doesn't apply your changes. Live experiences don't need it.
  • The QA overlay: keep 'unsafe-inline' in style-src even if you use nonces, because the overlay adds styles a nonce can't cover.
  • A Convert Custom Domain: add your custom hostname to script-src, connect-src and img-src. The tracking script and the Convert Signals & Heatmaps files load from it, and tracking data is sent to it. Depending on your setup, log, Convert Signals & Heatmaps and geo data go there too. Visual Editor images still come from cdn-3.convertexperiments.com.

Example: Adding Convert to an Existing Policy

Here's a connect-src directive before you add Convert. The example.com and example.net hosts stand for the tools you already use:

connect-src 'self' https://analytics.example.com https://chat.example.net;

Correct: Convert's source is added at the end and nothing is removed.

connect-src 'self' https://analytics.example.com https://chat.example.net *.convertexperiments.com;

Wrong: this replaces the existing sources, so your analytics and chat tools are blocked.

connect-src 'self' *.convertexperiments.com;

If your policy has no connect-src yet, start from your default-src sources. For example, if your policy has default-src 'self' https://analytics.example.com;, add:

connect-src 'self' https://analytics.example.com *.convertexperiments.com;

Do the same for each directive in the list above that applies to you.

Using Nonces

Convert supports CSP nonces. The tracking script takes the nonce from the first element on the page that has one and adds it to the styles and scripts it creates, so an element with a nonce must already be on the page when the Convert script runs.

Two parts of Convert don't receive the nonce:

  • Convert Signals & Heatmaps bundles. With a nonce-only script-src, also add 'strict-dynamic' or *.convertexperiments.com (and your custom hostname if you use one).
  • The QA overlay. Allow https://app.convert.com in script-src and keep 'unsafe-inline' in style-src.

Update and Test Your Policy

  1. Find where your CSP is set. It's usually an HTTP response header set in your web server configuration (for example .htaccess or nginx.conf), or a <meta http-equiv="Content-Security-Policy"> tag in your pages. Check for both, since a site can have more than one policy.
  2. Add Convert's sources to your existing directives, following the rules above.
  3. Test before you deploy, on a staging copy of your site if you have one. Open your browser's developer tools and check the Console and Network panels for blocked requests, both Convert's and your other tools'. Also try the Convert features you use, such as experiences, Convert Signals & Heatmaps, Visual Editor images, draft previews and the QA overlay.
  4. Deploy once everything loads.

If something is still blocked, send our support team the CSP error from your browser console.