If you have any problems collecting data when installing using Google Tag Manager, there are a few troubleshooting steps you can take to check things are set up correctly.
- Verifying Installation within Hotjar
- Checking both GTM and Hotjar are installed
- Ensure that Hotjar is triggered on page view
Ensuring Hotjar is triggered on pageview is essential for SPA sites.
For more information, head to the Ensure the Hotjar is triggered on page view section.
If you haven't yet installed Hotjar through Google Tag Manager, take a look here to find a step by step guide.
Verifying installation within Hotjar
The first thing you should do is try verifying the installation inside Hotjar. If this step works, then you should be ready to start collecting data.
If data is still not being collected, move on to checking both GTM and Hotjar are installed.
Checking both GTM and Hotjar are installed
Open up your browser Developer Tools while on a page you want to track with Hotjar.
How to open your browser Developer Tools
To open your developer tools, press Ctrl + Shift + i on Windows, Command + Option + i on Mac.
Click on the Network tab, and refresh your page.
Find your GTM script.
It should start with gtm.js?id=GTM, and ends with your unique Google Tag Manager ID.
Find the Hotjar script.
Your Hotjar script will start with hotjar-, followed by your Hotjar Site ID.
-
If you see neither the GTM script or Hotjar script: you have not installed GTM on your site yet. Find out how to install GTM in this support article.
-
If you only see your GTM container: you may have forgotten to publish your Hotjar tag. Check Step 8 in our installation on GTM article, or visit GTM documentation on publishing a tag. Additionally, confirm that the GTM container loading on your live page, matches the container where your Hotjar tag was added. (Example: GTM-N48ZZ5K is the container shown in the screenshot above.)
-
If you see more than one Hotjar script: there are two possibilities. The first is that you may have installed Hotjar on your page before installing using GTM. You should remove one of the tracking codes. The second possibility is that you may have set your tag trigger for something other than "Page View", which causes GTM to load the script multiple times.
You can read more about changing GTM trigger types in the section below, called Ensure that Hotjar is triggered on page view.
Ensure that Hotjar is triggered on page view
If you see more than one Hotjar script running on your site, you may have already installed Hotjar on your page before or you may have set your tag trigger for something other than Page View. This is typically seen with sites that are Single-Page Applications.
For Hotjar to work properly, our tracking code tag needs to be firing the trigger on Page View. Any other event for the trigger setting will cause multiple tracking codes (or none at all) to run in a single visit, preventing Hotjar from tracking your page properly.
Custom firing triggers can work, but they are unsupported
If you want to use a firing trigger other than Page View to load the Hotjar tracking code, that's not a problem. However, Hotjar Support cannot help to troubleshoot any custom setups.
The Triggering section of your tag should show All Pages and Page View:
If you see another trigger type on that screen, follow these steps:
Click on the Triggering title to edit the trigger.
Click the minus (-) button on the right-hand side of the trigger.
Click Choose a trigger to make this tag fire...
Select All Pages.
Click the Save button in the top right corner.
Submit your changes.
Make sure your live environment is selected, and click Publish.