When A/B testing, you may wish to run an Feedback widget on a specific variation of your page.
Hotjar allows you to target users on a specific page variant using Events. Follow these steps to set up your Feedback widget for targeting a specific test variant.
Events will take priority over URL-based targeting rules
If a targeted event is present on a page, it will cause the Feedback widget to show regardless of any URL-specific rules on the page.
Add the Hotjar event code on your variant page(s).
Add the event code needed to trigger the Feedback widget on the variant page(s) you wish to target. If you're unfamiliar with implementing events, check out our Events API documentation.
Below is an example to help you get started. Be sure to replace viewed_test_variant_b with the custom event name you will use for your Feedback widget.
window.hj=window.hj||function(){(hj.q=hj.q||[]).push(arguments);};
hj('event', 'viewed_test_variant_b');
In the above example, the Feedback widget would be displayed on the page variant which contains the event viewed_test_variant_b.
Visit the Feedback page in Hotjar and click + New widget.
Enter a Name and continue setting up the Feedback widget until you reach the Targeting section.
In the Targeting section, select Specific pages.
Select Event from the Specific page dropdown and enter the event name.
Only alphanumeric characters, dashes, and underscores can be used in the event name. For example, viewed_test_variant_a.
Continue with the Feedback widget set up, then select Active and click Start Feedback.