How do I install the code snippet?
To implement changes and track the data, you will need to install the snippet to the experiment pages on your website.
Adding the snippet to your website is a one-time process per project. The code automatically updates for any changes you make in the experiment. All your experiments under one project can be run multiple times, provided the code is installed on all the experiment webpages.
- Go to the Snippet page by clicking the Snippet icon in the left pane of the Projects page.
- Paste the code snippet into the page(s) of your website. The snippet must be pasted at the start of the <head> tag of the webpage’s HTML code.
NOTE: Once the code is installed on your webpage, it does not require modifications every time to run various experiments. Multiple experiments of Split URL test and A/B test can be performed with the same code snippet installed in the webpage, for all experiments on the project level.
You can verify if the code snippet is installed on your webpage successfully by entering the experiment URL in the Verify Your URL section of the Snippet page.
If a URL installation error appears, check if you have:
- Pasted the code in the indicated section of your webpage's HTML code.
- Made any accidental typographical mistakes in the code snippet.
If the error persists, delete the code snippet and try again.
Asynchronous Code Snippet:
We recommend that you use the asynchronous code snippet when you're conducting a Funnel Analysis or Heatmap experiment. Using an asynchronous code snippet in tests can cause a "flicker" on the page when the original loads, followed immediately by the variation.
An asynchronous code loads in parallel to your webpage and does not affect the loading time of your website. The asynchronous code has a timer set for the pages to load and if a page fails to load within the set time, it stops execution and the original website version is displayed instead.
Synchronous Code Snippet:
We recommend that you use the synchronous code snippet when you're conducting an A/B test or a Split URL test. Using a synchronous code snippet has negligible effect on the page's load time.
A synchronous code snippet executes each function or statement in HTML code one after the other, following the tag. If the synchronous code snippet fails to execute, it will block any further execution of the code.