Running Hotjar polls on specific events through Google Tag Manager

Recently I had to run a Hotjar poll after a successful signup uncovering hooks. We wanted to ask users what persuaded them to sign up. But our registration is not happening on a dedicated thank-you page – there’s a GTM data layer event which is loaded when a signup happens.

For Plus and Business accounts (paid) Hotjar offers an option in poll settings called JavaScript Triggers. So that’s what we’ll use here. Let’s build a new poll by going to Polls – New and give it a name.

On the Targeting step we’ll click On pages I specify and select the last option (unfortunately it will be active in paid plans only)

Hotjar polls JS trigger

We’ll call the Hotjar event ‘success’, so that’s what I’ll enter here:

poll settings

Finish the rest of the poll setup: Question, Appearance and Behavior, and let’s head to Google Tag Manager to add the special JavaScript trigger that will show the poll on the specific event we want.

Start by creating a new Custom HTML tag in GTM. Give it a name and paste the following in the HTML box:

<script>
hj(‘trigger’, ‘success’);
</script>

It comes from the Hotjar documentation on JavaScript triggers.

Here’s our tag, where┬áI’ve selected an existing datalayer event for trrigger:

Hotjar poll tag in GTM

That’s it – just save and publish the tag in GTM and enable your poll in Hotjar!

is a Google Analytics fan, who also loves SEO, conversion optimization, online marketing and social media. You can follow her on Twitter and LinkedIn.

Leave a Reply

Your email address will not be published. Required fields are marked *