To implement Kameleoon on your website, add a JavaScript installation tag to the HTML source code of your pages.Documentation Index
Fetch the complete documentation index at: https://docs.kameleoon.com/llms.txt
Use this file to discover all available pages before exploring further.
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 does not 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 achieve the best possible results.
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 as soon as the application code loads (usually under 50ms) or when the specified timeout (default 750ms) 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 (e.g., 100ms) may not allow enough time for the browser to download and execute the file, especially on slow connections or when other scripts are queued.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 is not 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 does not provide technical support for flickering issues caused by TMS implementations. TMS environments do not 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.