When A/B testing, you may wish to run an Feedback widget or display a Survey 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 or Survey tool for targeting a specific test variant:
Events for Surveys and Feedback are only available on the Ask Plus, Ask Business, and Ask Scale plans.
Events for Surveys and Feedback can only be used on our paid Ask plans. If you're interested in upgrading, see our article on How to Upgrade Your Hotjar Plan.
Start the Survey or Feedback tool setup.
Click the New Survey or New Feedback Widget button found in their respective dashboards.
Select "On pages I specify" in the Targeting section of the settings:
The example above is taken from a Survey configuration page. Feedback configurations may look slightly different.
Choose the Event you want to use for targeting.
Select Event from the drop down list and enter the name you will use for your event in the target field. Only alphanumeric characters, dashes, and underscores can be used in the event name. (Example: viewed_test_variant_a)
You can select the + icon if you would like to add another targeting rule.
Enter any additional targets you'd like to use for targeting the Feedback widget.
Click the + icon if you would like to add another targeting rule.
Events will take priority over URL-based targeting rules
If a targeted event is present on a page, it will cause the Survey or Feedback widget to show regardless of any URL-specific rules on the page.
Click Done.
Update the 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.
Below is an example to help you get started. Be sure to replace viewed_test_variant_b with the custom event name that you created for your Feedback widget.
window.hj=window.hj||function(){(hj.q=hj.q||[]).push(arguments);};
hj('event', 'viewed_test_variant_b');
In this example, the survey would be displayed on the page variant which contains the event, 'viewed_test_variant_b'.
Want to learn more about Events for Surveys and Feedback tools?
Find more information and examples on Using Events for Survey and Feedback Tool Targeting.