Skip to main content


Optimizely Knowledge Base

Integrate Optimizely with Hotjar

  • Tag Hotjar recordings with Optimizely experiment & campaign data
  • Create specific Hotjar HeatMaps for your experiment & campaign

This article will show you how you can integrate Hotjar with Optimizely for Hotjar HeatMaps & Recordings. 

What does this integration let you do? 

This integration lets you tag Hotjar HeatMaps and Recordings with Optimizely experiment and campaign information.

  • For Hotjar Recordings: you may want to see if your visitor's behavior has changed because of changes in a variation. With Optimizely experiment information in your Hotjar recordings you'll be able to filter recordings per variation.

  • For Hotjar HeatMaps: Similarly, you may want to see if changes in a variation lead to visitors scrolling further down or clicking on re-designed elements. With Optimizely experiment and campaign information in Hotjar HeatMaps, you are able to drill down per variation and get a better understanding of your visitors' scrolls, clicks and moves. 

The Hotjar integration is owned by Hotjar. Currently, only Hotjar Recordings & Feedback is supported by the integration. Development on the integration to enable Heatmaps is ongoing/on the roadmap. If you have any questions regarding the Hotjar integration, please reach out to Hotjar's Support Team.

Set up the integration with Hotjar HeatMaps

Pre-requisite 1: The Hotjar HeatMaps and Recordings integration needs to be added to your account and enabled. You can get the extension here.

Pre-requisite 2:  the force variation parameter needs to be enabled. It can be enabled by going to the Settings tab in Optimizely, then make sure the "Disable force variation parameter" box is unchecked. 

  • In Optimizely, get your experiment's variation IDs. You can get them by going to the experiment in the Optimizely UI, clicking onto the experiment you want to integrate, and clicking on API Names. You will find the variation IDs in the Variations section. 

  • Write down the IDs, we will need them later.

  • In Optimizely, head into the experiment you want to integrate Hotjar with, click on the Integrations tab. You should see the following: 


If you do not see this, this means the integration is not enabled in your account. Check out Pre-requisite 1 to figure out how to enable it.  

  • Make sure the HeatMaps field is set to "ON" and enter a Javascript trigger prefix. This can be any string and we recommend using a shortname of your experiment name. This will not appear in Hotjar and is only used by Optimizely to trigger the right heatmap matching your experiment. We recommend to avoid the use of special characters. Example of acceptable prefix : homepageRedesign.

  • Head to Hotjar and create one heatmap per variation.

  • On Step 3: Page Targeting, select "Trigger a Javascript snippet" and select "Javascript trigger" in the "Enter Page URL" section. For the value of the Javascript trigger, enter the prefix you picked before + an underscore ( _ ) + the variation ID. Example of correct prefix: homepageRedesign_8575810288. 

  • In order for Hotjar to show a screenshot of your variation, we'll need to tell Hotjar how to force itself into your experiment's or campaign's variations. To do so, in the Page Targeting section in Hotjar, in the "Custom Screenshot URL" field, enter the URL of a page where the experiment is running and append to this URL Optimizely's force variation parameters. The final URL should look something like this:[variationId]

  • Generate the heatmap and start the Optimizely experiment 

If you are running a personalization campaign with a holdback that is not set to 0%, you will need to create a Hotjar Heatmap for the holdback. When creating this heatmap, input the Javascript trigger in Hotjar as follows: your prefix + underscore ( _ ) + holdback. For example if the prefix is homepageRedesign then the Javascript trigger will be homepageRedesign_holdback. Also, leave the "Custom Screenshot URL" field in Hotjar empty. 

Set up integration with Hotjar Recordings

Pre-requisite: The Hotjar HeatMaps and Recordings integration needs to be added to your account and enabled. You can get the extension here:

This integration will add a tag to Hotjar Recordings. This tag will be labeled with Optimizely experiment, audience and variation information.

To enable this integration, head to the experiment you'd like to tag recordings with, and set the "Recordings" field to "ON". Check the "Tracked" box and Save. 


That's it! This experiment will now tag all visitors with Optimizely experiment & campaign information and this tag will show up in your Hotjar recordings.