Linus Larsson

Importing HotJar data into Google Analytics

Are you using HotJar to get valuable insights of what your visitors are doing on your website? I bet you wouldn't mind getting that data integrated with Google Analytics to make even more advanced analyses. This post is basically an extension to a post that one of my colleague, Eivind Savio,  wrote some time ago. If you implement the tracking in Google Tag Manager as he recommends in his post, then you will be able to do what I'm gonna show you now.

So first I'm gonna give you an example of two use cases in order for you to understand the value of this. First off, let's say you have five big personas that you use in your marketing and website strategies. Wouldn't it be cool to be able to create segments of those personas in Google Analytics? With this method that will be possible. Just make sure that the questions you ask in the survey or poll can define the user as a persona!

The second use case is if you are measuring NPS (Net Promoter Score) on your website and would like to be able to analyze the traffic based on the loyalty level from the NPS poll. So how do we do this in an easy way?

Step 1

Make sure you implement the tracking that is necessary in Google Tag Manager, as described in this blog post.

Step 2

Set up a poll or a survey in HotJar. In this case I have set up a poll measuring NPS.

Step 3

Let the poll run for a while in order to get some results. Once you got some, you can start the process of importing it to Google Analytics. Create a new spreadsheet in Google Sheets and create some columns; one for "user" and one for each answer of the poll you created. In this case there will only be one question and therefore two columns in the sheet.

Step 4

Download your responses from HotJar as an XML.

Now you will need to copy the data from the downloaded file and paste it into the Google Sheet you created in step 3. You only have to use the columns that are relevant for the Sheet.

Now you have everything you need to make the data import. The key is going to bi the user ID, since you sent that data to Google Analytics in the tracking you created in step 1.

Step 5

Create a new custom dimension in Google Analytics. Make sure that you set it to the same scope as you did with the HotJar User ID. What we are going to do is that we're going to use the IDs in our sheet and then find them in Google Analytics. If we find a match, this new custom dimension will be populated with the value of our second column in the Sheet.

Step 6

Next up, we're going to import the data. Choose "Data import" at the bottom of the admin settings for property in Google Analytics. In "Data set type", choose "Custom data". Name the variable in a way that you will remember what it is and then choose which views should receive the HotJar data (I usually choose all views). Now you will be asked to select matching keys. As I wrote before this will be the HotJar User ID in Google Analytics and the "user" column in the Google Sheet, so choose the HotJar User ID in the first box.

In the second box you will have to pick the dimension to which you will send the imported data. Here you should pick the new dimension you just created.

That's it! You can now use the HotJar data in your new custom dimension to create more advanced reports, segments and dashboards. This is an easy way to gain more relevant insights into your users behaviour. Make sure to comment what you used the function for!


Comments are currently not available due to roll out of custom built blog theme. I'm working on getting this available again, but in the mean time you can write to me on LinkedIn if you have any questions.

© Copyright - - 2018-2021