7

Recently, our company started using Hotjar to collect usage data. As this is my first time using the service, I made some mistakes, which made me search for a method for debugging. After reading the official documentation, forums, stackoverflow, I found nothing.

What do I have to do/modify to enable debugging in Hotjar?

service-paradis
  • 3,333
  • 4
  • 34
  • 43
Adam Benedek
  • 592
  • 4
  • 17

1 Answers1

17

You can enable debugging in the tracking script. Just add the following line in the h._hjSettings line: hjdebug:true

<!-- Hotjar Tracking Code for www.example.com -->
<script>
(function(h,o,t,j,a,r){
    h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
    h._hjSettings={hjid:YOUR_CUSTOMER_ID,hjsv:HOTJAR_VERSION_NUMBER,hjdebug:true};         
    a=o.getElementsByTagName('head')[0];
    r=o.createElement('script');r.async=1;
    r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
    a.appendChild(r);
})(window,document,'//static.hotjar.com/c/hotjar-','.js?sv=');
</script>

When you use the tracking code this way, your console will display basically everything that happens during the process. For me, it was especially helpful as it helped me make sure that the virtual page views registered without any errors.

Example console output, potentially sensitive informations hidden

Adam Benedek
  • 592
  • 4
  • 17
  • have you ever seen this message? `COMMAND: Command "vpv" blocked due to opt-out` – alesdario Apr 04 '19 at 08:02
  • 1
    @alesdario 'vpv' stands for Virtual Page Views, a command called manually from the code to log a pageview on a single page app, or when you have multiple content/pages on the same url. Check this url on the browser that produced this error to see if the broswer has a cookie that blocks hotjar: https://www.hotjar.com/legal/compliance/opt-out It's also possible that the browser in question send a 'do not track' request, that hotjar respects - that also could result in the message you posted (at least I think) – Adam Benedek Apr 04 '19 at 08:21