Skip to content

Instantly share code, notes, and snippets.

@hristiank
Last active March 20, 2020 07:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hristiank/bd6c3e6cde151f335f30cfda7d82e9ba to your computer and use it in GitHub Desktop.
Save hristiank/bd6c3e6cde151f335f30cfda7d82e9ba to your computer and use it in GitHub Desktop.
Hotjar JS Trigger for Unbounce Variations
<script>
if (window.ub && window.ub.page) {
hj('trigger', window.ub.page.variantId);
}
</script>
<script>
if (window.ub && window.ub.page) {
hj('trigger', window.ub.page.variantId + '_' + window.ub.page.id);
}
</script>
@hristiank
Copy link
Author

hristiank commented Mar 24, 2017

If you or your clients are on the Plus or Business tiers in Hotjar, you can use a JavaScript trigger for heatmaps.

  1. Add the above piece of code after your main Hotjar script.

  2. Publish/republish your landing page

  3. When creating a heatmap in Hotjar select the JS trigger option. The value for the trigger would be the letter of your variation.

3.1 Yes, you need to create a separate heatmap for each variation ;)

hotjar-trigger-unbounce

Enjoy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment