Hotjar seem to have gone back on the user ID. I tried implementing it about a month ago in GTM, and it looks like the ID changes on each page load.
My question to HJ support:
My question regards accessing Hotjar User ID in page DOM.
This used to be available as a 'userId' variable in hj.property, then hj.pageVisit.property, but now it is not.
The variable 'key' available in hj.pageVisit.property has the same format as User ID, but is reset on page reload.
Is there a way of retrieving the user ID now?
This is what I got from them:
I'm told that we may provide this ability again in the future, though I don't have an ETA for it at the moment, as we're currently focusing on improving other aspects of Hotjar.
Checking our current requests for this, it unfortunately seems that not a lot of users are voting on this feature - this is why it's pivotal for us to get this feedback on our "Suggest a Feature" tool.