Hotjar on Staging/Testing Servers

Warning

Hotjar doesn’t fully support troubleshooting installation on staging servers and localhosts. Following the tips below should help Hotjar work with many types of staging server and localhost setups, but because Hotjar is only able to provide support for servers that are publicly accessible, we can’t guarantee this will solve every issue.

Hotjar tracks data whenever the Tracking Code is invoked by a visitor, sending the data to the appropriate site by reading the hjid (which is the site ID), irrelevant of the domain it is being loaded from. For this reason, if you have a staging or testing server set up, visits will also be tracked and recorded from it.

Exceptions to take into consideration

Our Forms feature currently loads the page you enter in a headless browser which parses the HTML to detect Forms. If the page is not publicly available, Hotjar wouldn't be able to access the HTML of that page and in turn, will not find any Forms.

Heatmaps, Incoming Feedback and Recordings rely on the images and CSS files being publicly available (not the HTML or javascript though). We store the HTML on our end when recording visitors, but when we either take Heatmap/Incoming Feedback screenshots or you view a Recording, the assets are loaded from your server.

Loading Hotjar on live site and not on Staging / Testing Servers

If you have the Hotjar Tracking Code installed on both your live and testing/staging servers but only wish it to send data to Hotjar from your live server, you need to wrap the Hotjar Tracking Code in an IF statement which checks the current URL the visitor is on.

Assuming your site is www.example.com, this is how you would set it up:

Tips for using Hotjar on Staging Servers and Localhost

In order to have Hotjar run correctly on your Staging Server or Localhost we suggest these 3 tips:

Your site needs to be accessible from our servers. Having your site publicly available and not behind a firewall is best. However, if it isn’t, Hotjar’s domains must be whitelisted and have access to collect assets/HTML from the site.

Your site needs to use valid HTTPS certificates if it uses HTTPS. We cannot guarantee self-certifications will allow our tracking code to work correctly.

Whatever computer you are using to view your data, the IP needs to have access to your site. All elements, such as CSS, will need to be accessible to the person viewing the Recording to show correctly.