This article involves the Events filter, which is available on Observe ,
or
plans.
This article involves the Events filter, which is available on Observe or
plans.
When A/B testing, you can use Recordings to see user behavior on different variations of your page or site. Using JavaScript and our Events API, you can send an event to Hotjar when users land on a specific version of an A/B test page. The event filter can then be used with your Recordings to isolate sessions where a specific variant was visited.
Before setting up Events with your A/B test, we recommend reviewing our articles on What Are Events and How to Set Up Events. To use Events with A/B testing, you could add code similar to what is shown below to each page variation you'd like to track. For each page, you would replace viewed_homepage_A and viewed_homepage_B with the name of each of your test variations.
hj('event', 'viewed_homepage_A');
hj('event', 'viewed_homepage_B');
When comparing two variants, ensure each page has a separate event being sent to Hotjar. An example would be having the event viewed_homepage_A sent when loading variant A, and viewed_homepage_B sent when loading variant B. Find more details on using our Events API and best practices in our Events API Reference article.
After adding the page variant events to your site, Hotjar will be sent these events during user sessions on those pages. After a recording has been collected with the associated event, you'll see the events appear when selecting the event filter on your Recordings list page.
See our article, How Do I Filter Session Data, for more details on session filtering.