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.
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).
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.
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:
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.
default-src: *.responsetap.com
connect-src: *.responsetap.com
script-src: ict.infinity-tracking.net 'nonce-{SERVER-GENERATED-NONCE}'
connect-src: *.infinity-tracking.com ict.infinity-tracking.net
default-src: *.responsetap.com
connect-src: *.responsetap.com
You will also need to add the following domain in the script-src section of your CSP:
cm.g.doubleclick.net
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.