Implement Kameleoon in the HTML source code
For Web Experimentation, always add the Kameleoon tag in the<head> section of your HTML source code. Placing the tag in the <body> section, especially at the end of the page, increases the risk of flickering. Add the tag as high as possible in the <head> section, ideally immediately after the opening <head> tag. This position allows the browser to load the Kameleoon application file before other resources. CSS or other scripts placed before the Kameleoon tag increase the risk of flickering.
If you use hybrid mode (both an SDK and the JavaScript installation tag), you can place the tag later in the body, such as right before the closing
</body> tag. Flicker doesn’t occur when using a web SDK.Adding any script or resource to your website increases the load. Kameleoon prioritizes performance and optimizes its code to minimize that impact.
Asynchronous tag with anti-flicker
This method loads the Kameleoon script asynchronously and includes anti-flickering code. Kameleoon uses a “blocking CSS rule” to hide page content and removes it once the Kameleoon application file loads (usually under 50 ms) or when the specified timeout (default 750 ms) expires. This safeguard ensures that Kameleoon never causes your website to crash or stay blank indefinitely. Adjust the timeout using thekameleoonLoadingTimeout JavaScript variable in the installation snippet.
SITE_CODE placeholder with your project site code.
Kameleoon script domains vary by project. Projects use either
kameleoon.eu or kameleoon.io based on their creation date. Use the domain displayed in the Kameleoon App for your project.The timeout counter starts when the browser executes the code, not when it begins downloading
engine.js. Setting a timeout too low (for example, 100 ms) may not allow enough time for the browser to download and execute the file, especially on slow connections or when the browser queues other scripts first.Synchronous tag
This method loads the Kameleoon script synchronously to prevent flickering. However, this approach blocks page loading until the browser downloads and executes the Kameleoon code, which may impact performance.SITE_CODE placeholder with your project site code.
Kameleoon script domains vary by project. Projects use either
kameleoon.eu or kameleoon.io based on their creation date. Use the domain displayed in the Kameleoon App for your project.Asynchronous tag without anti-flicker
This tag installs the Kameleoon application file asynchronously without anti-flicker prevention. Use this tag if flicker isn’t a concern, such as when using hybrid mode.SITE_CODE placeholder with your project site code.
Kameleoon script domains vary by project. Projects use either
kameleoon.eu or kameleoon.io based on their creation date. Use the domain displayed in the Kameleoon App for your project.Implement Kameleoon in a tag manager
Kameleoon supports all major Tag Management Systems (TMS). To avoid flickering, install Kameleoon directly in your page’s source code. Using a TMS delays loading, which often results in noticeable flicker, especially if the TMS loads at the bottom of the HTML page. Kameleoon doesn’t provide technical support for flickering issues caused by TMS implementations. TMS environments don’t allow synchronous loading of external JavaScript. For TMS implementations, use the asynchronous JavaScript tag.Kameleoon script domains vary by project. Projects use either
kameleoon.eu or kameleoon.io based on their creation date. Use the domain displayed in the Kameleoon App for your project.