Does Hotjar still support Triggers and Tags added by JavaScript?
In the past, Hotjar used hj('trigger', 'example'); to fire events for targeting purposes, and hj('tagRecording', ['example_tag_1', 'example_tag_2']); for attaching tags for filtering recordings. These legacy events were referred to as JavaScript Triggers and Tags respectively.
If your site is already using the 'trigger' or 'tagRecording' calls, Hotjar will still respect these and they will not stop working. However, a 'trigger' will not be searchable in Recordings filters, and a 'tag' cannot be used for targeting Hotjar tools.
Events cannot be used to collect email or IP addresses, or numbers with 9 or more digits
Since there is currently no way to use our User Lookup tool with events, they cannot be used to collect emails, IP addresses, or numbers with 9 or more digits to prevent credit card numbers from being passed to Hotjar. This decision has been based on the General Data Protection Regulation (GDPR). If you'd like to collect email addresses with your user's consent and in line with GDPR, you can do so with User Attributes.
Events for Observe tools are available on the Observe Plus, Observe Business, or Observe Scale plans. Learn more in our Events API Reference guide.
Associating events with your Recordings allows you to note specific actions, like CTA clicks, sign-ups, or user states. Once Recordings have been associated with an event, you can then filter by those events in your Recordings dashboard.
Keep in mind the following best practices:
-
-
- Do not use Events to display any information unique to a user, or session. User Attributes have been designed for user data and should be used instead.
- For A/B tests, you may want to use generic events rather than specific identifiers, such as experiment codes, used by some A/B testing platforms
- For e-commerce sites, avoid specific product information, such as SKU codes. Usually, URLs are more useful and are captured by default.
- Avoid passing anything like dates or timestamps.
- Avoid passing anything from URLs such as referral codes.
- Avoid passing detailed errors logs.
- Be careful when sending values from objects such as GTM data layers. These often hold more data than you expect.
-
1000 event limit per Hotjar site
Hotjar Recordings Filters will only support 1,000 unique events per Hotjar site. If you exceed this, only 1,000 of the most used events (sorted 0-9, a-Z) will be searchable in the interface. This is a rolling total so once the limit is exceeded, some existing events may become unsearchable in the filter. If you exceed the limit, you can delete recordings that contain any events you no longer need. Around 10 minutes after deletion, your event filter list will refresh.
How to add Events to Recordings
To add an event to a recording, add the events you wish to send using JavaScript code like this:
hj('event', 'pricing_page_variant_b');
In this example, all recordings of users who trigger this event will contain the event label "pricing_page_variant_b" in their session playback.
This allows you to filter your Recordings based on a specific event. Your event can be fired at any time based on the JavaScript code used to trigger your event.
If there is a chance that the event code will be run before the Hotjar script has loaded, add this line of code just before the event code:
window.hj=window.hj||function(){(hj.q=hj.q||[]).push(arguments)};
The events can be any alphanumeric value you like including spaces, e.g. 'Checkout Page'. The Recording will fail to display an event if it has more than 250 characters.
A single Recording can have no more than 50 events associated with it. Any additional events will be ignored.
If you're interested in using Events to help target your users with Hotjar tools, visit How to Use Events for targeting Hotjar Tools.
You can also set up Hotjar Events through Google Tag Manager.
If you use Google Tag Manager to load the Hotjar script on your site, you can set up Events on the GTM tag that fires the Hotjar tracking code.