> ## Documentation Index
> Fetch the complete documentation index at: https://docs.conversion.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Content Security Policy

> Allow Conversion's scripts, forms, and files in your website's Content Security Policy, split by feature.

If your website sends a Content Security Policy (CSP), the browser blocks any script, request, or iframe from a host the policy doesn't list. Add the Conversion hosts for each feature you use so the tracking script and forms keep working.

You only need this page if your site already has a CSP. Without one, the browser allows Conversion's hosts by default.

## Set up your Content Security Policy

### Before you begin

* Access to wherever your site sets its CSP: the `Content-Security-Policy` response header on your web server, CDN, or hosting platform, or a `<meta http-equiv="Content-Security-Policy">` tag in your page template.
* The list of Conversion features you use on your website. See [Directives by feature](#directives-by-feature).

### Steps

1. Find each feature you use in [Directives by feature](#directives-by-feature).
2. Add each listed host to the listed directive. Keep the values already in your policy, such as `'self'`.
3. If your policy has a `script-src-elem` directive, add the `script-src` hosts to it too. Browsers use `script-src-elem` instead of `script-src` for `<script>` tags when both are set.
4. If your policy has no `frame-src` directive, add the `frame-src` hosts to `child-src`, or to `default-src` if `child-src` isn't set either. Browsers fall back to those directives for iframes.
5. Publish the updated policy.
6. Open a page that uses Conversion in an incognito window, accept tracking if a cookie banner appears, and open your browser's DevTools → **Console**.
7. Confirm there are no `Refused to load`, `Refused to connect`, or `Refused to frame` errors that mention a host from this page.

## Directives by feature

### Tracking script

The [tracking script](https://docs.conversion.ai/product-docs/tracking/tracking-script.md) loads from `p.conversion.ai` and sends page visits back to it.

| Directive | Host | Why |
| - | - | - |
| `script-src` | `https://p.conversion.ai` | Loads the tracking script. |
| `connect-src` | `https://p.conversion.ai` | Looks up your website's domain and records page visits. |

### Embedded Conversion forms

An [embedded Conversion form](https://docs.conversion.ai/product-docs/forms/conversion-forms.md) is an iframe from `forms.conversion.ai`, plus the [Forms SDK](https://docs.conversion.ai/product-docs/forms/forms-sdk.md) script that resizes it and passes it the visitor's tracking context.

| Directive | Host | Why |
| - | - | - |
| `script-src` | `https://forms.conversion.ai` | Loads the Forms SDK script. |
| `frame-src` | `https://forms.conversion.ai` | Displays the form in its iframe. |

The form submits from inside its iframe, so your page doesn't need `connect-src` for it. Everything the form loads inside the iframe, such as its fonts and reCAPTCHA, is covered by Conversion's own policy on `forms.conversion.ai`, not by yours.

Conversion's policy also lets the form display only on pages on your business's registered base domain. On any other domain, such as a staging site, the browser reports a `Refused to frame` error that mentions `frame-ancestors`. Your policy doesn't cause it, and changing your policy won't fix it. Turn on **Allow any origin for testing** in the form's [General settings](https://docs.conversion.ai/product-docs/forms/dashboard/settings/general.md) instead.

### Forms submitted with the Forms SDK

When your own code [submits a form with `ConversionFormsV1.submit()`](https://docs.conversion.ai/product-docs/forms/forms-sdk#submitting-a-custom-form), the Forms SDK sends the submission to `forms.conversion.ai` from your page.

| Directive | Host | Why |
| - | - | - |
| `script-src` | `https://forms.conversion.ai` | Loads the Forms SDK script. |
| `connect-src` | `https://forms.conversion.ai` | Sends the submission. |

### Tracked forms

For a [tracked form](https://docs.conversion.ai/product-docs/forms/track-existing-forms.md), the Forms SDK listens for submissions on your page and sends them to `p.conversion.ai`.

| Directive | Host | Why |
| - | - | - |
| `script-src` | `https://forms.conversion.ai` | Loads the Forms SDK script. |
| `connect-src` | `https://p.conversion.ai` | Sends each submission. |

### Public files

Add this only if you show a [public file](https://docs.conversion.ai/product-docs/content/public-files.md) on your website, such as an image or a video, from Conversion's default domain.

| Directive | Host | Why |
| - | - | - |
| `img-src` | `https://conversion-files.com` | Displays images. |
| `media-src` | `https://conversion-files.com` | Plays audio and video. |

If you serve files from your own domain, add that origin instead, for example `https://assets.yourcompany.com`.

### Inline scripts in form snippets

The programmatic submit snippet and the `set-values` snippet in a form's settings are inline `<script>` blocks. If your policy doesn't allow inline scripts, move that code into a JavaScript file on your site, or allow the block with a nonce or hash in `script-src`. The embed snippet has no inline script.

## Full policy for all features

These are the directives for the tracking script and every kind of Conversion form, combined. Merge them into your existing policy rather than replacing it:

```http theme={null}
Content-Security-Policy:
  script-src https://p.conversion.ai https://forms.conversion.ai;
  script-src-elem https://p.conversion.ai https://forms.conversion.ai;
  connect-src https://p.conversion.ai https://forms.conversion.ai;
  frame-src https://forms.conversion.ai
```

Add `script-src-elem` only if your policy already uses it. If you show public files from Conversion's default domain, also add `https://conversion-files.com` to `img-src` and `media-src`.

## Features that don't need CSP changes

| Feature | Why |
| - | - |
| [Landing pages](https://docs.conversion.ai/product-docs/landing-pages/overview.md) | Conversion serves them on the domain you point at it, with its own headers. Your website's policy doesn't apply. |
| [Lead generation forms](https://docs.conversion.ai/product-docs/forms/lead-gen-forms/overview.md) | Conversion syncs leads from Meta and LinkedIn. Nothing loads on your website. |
| [Emails](https://docs.conversion.ai/product-docs/emails/overview.md) | Emails don't load in your website. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.