Recordings and Heatmaps are based on session capture. By making changes to your session capture settings, it's possible to start capturing sessions only when an event occurs on your site (for example: clicks, scrolls, typing etc.). To get started, you'll first need to set up the Hotjar Events feature on your site. Our article on How to Set Up Events can help with this.
It is not possible to trigger a Heatmap screenshot based on an event
It isn't possible to trigger a screenshot based on an event, however you can filter Heatmap session data based on an event. When filtering, Hotjar will show data collected from sessions where users triggered the event at some point during their session. This doesn't mean the Heatmap screenshot will be captured at the moment the event fired.
For A/B testing purposes, ensure the event names you're using are unique to the page being tested.
After your site is successfully sending events to Hotjar using the Events API, follow the steps below to set up session capture targeting for Recordings and Heatmaps based on events.
You can send Events using Google Tag Manager, Google Analytics, or Segment
It's possible to start sending Events to Hotjar using Google Tag Manager, Google Analytics, or Segment. For more details, see our How to Send Events with Google Tag Manager article, Using Hotjar with Google Analytics, or if you're using Segment visit our Using Hotjar with Segment guide.
Visit your Sites & Organizations page.
Click on the site settings gear icon to visit the site settings page.
Click on the Session targeting & tracking section on your site settings page.
Select Start capturing sessions on specific pages or when a custom event fires.
Enter the event name in the Event field.
This is the name of the event that, when triggered on your site, will start session capture for Recordings and Heatmaps.
Click the + icon if you would like to add another targeting rule. Only alphanumeric characters (a-z, A-Z, 0-9), underscores (_), and dashes (-) can be used in the event name.
Events take priority over other targeting options such as URLs
If an event is present on a page, it will take priority over other targeting rules present, including URL targeting rules.
Click Save Changes.
Session capture for Recordings and Heatmaps will start based on these event settings.