Plan availability
Available for Recordings and Heatmaps with Observe , Observe , or Observe Available for Recordings and Heatmaps with Observe , Observe
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: a modal appears, user scrolls, typing etc.). You can also use events to exclude your employees from Hotjar tracking.
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.
In this article, you can learn more about
- Setting up session targeting triggered by a specific event
- Using events to exclude your employees from Hotjar tracking
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.
Setting up session targeting triggered by a specific event
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.
Using events to exclude your employees from Hotjar tracking
Currently, IP blocking is the recommended solution to exclude your employees from Hotjar tracking. However, you can also use events to achieve this result. Adjusting session capture settings can help you keep your data clean and relevant.
In your website's code, define a cookie that is stored only for users that are your employees.
Consult a web developer to find the optimal solution for your specific website setup.
Adjust your website's code to send an event to Hotjar only if the employee cookie isn't present.
As an example, you could achieve this by using an if statement to check for the cookie presence:
if (isNotEmployee) {
hj('event', 'start_hotjar');
}
The isNotEmployee condition should check if the employee cookie is present. If the employee cookie is not present, the start_hotjar event should be fired.
Modify your Session targeting and tracking settings in Hotjar, using the event name to start the session capture.
Follow the steps described in the Setting up session targeting triggered by a specific event section above to complete the setup.
See also
- What are Events?
- [Course] Events for Recordings
- Events API Reference
- When to use Events and User Attributes