Infinity Campus

Using Infinity with a Content Security Policy

Written by Infinity | Nov 19, 2026, 11:39:55 PM

Infinity content security policy settings let Infinity tracking run on a website that already uses a Content Security Policy (CSP). If your site has a CSP, you need to add Infinity's domains to it. This guide explains what a CSP does, which domains to add for each Infinity JavaScript set-up, and the two ways to allow them.

What is a CSP?

Content Security Policy (CSP) is an added layer of security that helps to detect and mitigate certain types of attacks, including Cross-Site Scripting (XSS) and data injection attacks. These attacks are used for everything from data theft, to site defacement, to malware distribution.

Some websites have implemented additional code to only authenticate scripts or elements run from third-party websites. This additional code is referred to as Content Security Policies (CSP).

What does a CSP do?

A CSP allows websites to allow or restrict scripts, stylesheets and assets (fonts and similar) from being loaded from third-party locations. You can enable it in report only mode, so it warns you if something is being loaded from a domain you haven't allowed. Alternatively, you can run it in strict mode, which actively blocks that content.

Further details on CSP can be found here.

Infinity content security policy: domains to add

If you have a CSP defined for your site, you will need to make an amendment to allow Infinity tracking to run. Add the domains below to the corresponding properties in your Infinity content security policy, alongside any others you already have defined.

There are two options. One is to use a nonce. The other is to add the unsafe-inline directive to the CSP script-src section.

The recommended method is to use a nonce, which should be a non-guessable, random value that the server generates individually for each response. Supply the nonce value in the Content-Security-Policy script-src directive:

Text
Content-Security-Policy: script-src 'nonce-{SERVER-GENERATED-NONCE}'

If you're using a nonce, you will need to generate it server-side per pageview and include it in both your Content Security Policy and the script tag that loads your Infinity code.

The simpler approach is to use unsafe-inline. There are security implications, however, which can negate the impact of having a CSP. If you don't already have a Content Security Policy, you will need to review the CSP documentation for any other services you are using and allow access to those too.

If you are using the latest Infinity JavaScript snippet

Text
default-src: *.responsetap.com
connect-src: *.responsetap.com

If you are using the older Infinity JavaScript snippet, which used the JavaScript Generator page in Infinity

Text
script-src: ict.infinity-tracking.net 'nonce-{SERVER-GENERATED-NONCE}'
connect-src: *.infinity-tracking.com ict.infinity-tracking.net

If you have migrated from ResponseTap and haven't yet replaced your code with Infinity JavaScript

Text
default-src: *.responsetap.com
connect-src: *.responsetap.com

If you are using the Infinity Campaign Manager integration

You will also need to add the following domain in the script-src section of your CSP:

Text
cm.g.doubleclick.net

Need more help?

For the Infinity JavaScript snippet itself, see Install the Infinity JavaScript code. If you encounter difficulties or have any questions, please contact our Support team at support@infinity.co, who will be happy to assist you.