Capturing a Hotjar user ID in Google Tag Manager and Google Analytics

We have a setting in which we collect the Hotjar user ID in Google Tag Manager and then pass it as a custom dimension for Google Analytics. This is done to easily merge and cross-reference both data sources.

We used the following code to write the user ID:

function() { return hj.property.get('userId'); }

After 2 days, we stopped receiving data, even though there were no changes to the Google Tag Manager, Google Analytics and our Hotjar account.

My suspicion is that at the end of Hotjar there was a system update. I chatted with their technical support, but they could not help me.

It would be great if someone with more experience could look at the following file to find out if there is a way to capture the value of userId:

https://script.hotjar.com/modules-397099a69f05558cbf66f164cffcaf65.js

thank

+4
source share
5 answers

Give it a try hj.pageVisit.property.get('userId'). Today, he returned me the correct user interface.

+7
source

Looking at the JS file downloaded by HotJar, I found the following code

hj.hq.isUndefined(hj.globals.get("userId"))

From this I learned the following

hj.globals.get("userId")

And it works for me today. Hope this helps someone else. Please let me know if this worked in all cases.

+1
source

, DOM .

Hotjar:

... , Single Page . , , ETA, Hotjar.

, , , - " "

Cheers, Florian .

0

, setTimeout, :

hj.pageVisit.property.get('userId').

OBS: IE ... undefined .

0

For some reason, from November 1, the above code no longer works. At least for me. Does anyone have a similar problem and maybe a solution?

0
source

Source: https://habr.com/ru/post/1661006/


All Articles