How should you configure a web site to work with Convert's technology?
Ensure Convert Visual Editor & Tracking Work Seamlessly with Correct Site & CSP Configurations
THIS ARTICLE WILL HELP YOU :
1. Configuring Your Site to Work with Convert Visual Editor
If the tracking script is installed and the Chrome Debugger extension is used (with the domain whitelisted), your website should load within the Convert Visual Editor (VE) regardless of headers.
However, if the tracking script is not installed, your website will load in compatibility mode, where certain functions might not be available. In such cases, or if the tracking script is installed but the extension/domain is not whitelisted, it is crucial to ensure that the webpage is allowed to load in an iframe where the parent frame is not under the same domain. This requirement can be complex to meet due to various blocking mechanisms, such as:
- HTTP headers: x-frame-options, content-security-policy, referrer-policy, sec-fetch-site, sec-fetch-mode, sec-fetch-user, sec-fetch-dest, referer
- JavaScript code on the page that detects loading within an iframe using checks based on the parent frame, referrer, etc.
Given the numerous factors that can influence this, it is challenging to provide a definitive checklist. While reviewing the above aspects can be helpful, determining the appropriate values for these headers can be tricky since they often serve specific security purposes.
The best recommendation is to use our Debugger extension, which aims to address any potential blocking methods. If a new blocking mechanism is discovered and reported to us, we typically update the extension to handle it, provided it is technically feasible.
2. Configuring Your Site to Work with Convert's Tracking Code
If your site has a Content Security Policy (CSP), the browser blocks anything the policy doesn't allow, including Convert's tracking code. Add Convert's sources to the policy you already have. Don't replace it, or the other tools on your site can stop loading.
- Locate your CSP. It's usually an HTTP response header set in your web server configuration (for example
.htaccessornginx.conf), or a<meta http-equiv="Content-Security-Policy">tag in your pages. Check for both. - Add Convert's sources to your existing directives. Add them at the end of each directive's list and keep everything that's already there. The directives Convert needs are
script-src,connect-src,img-srcandstyle-src. Some features also needworker-srcorframe-src. - Test your configuration. Open your browser's developer tools and check the Console and Network panels for blocked requests, both Convert's and your other tools'.
- Deploy your changes once everything loads.
The sources each directive needs, a before-and-after example, nonces and Custom Domains are covered in How to Configure Your Website's CSP Policy for Convert Experiments.