H Hotjar

How to install via Google Tag Manager on Hotjar

intermediate 8 min read Updated 2026-03-18
Quick Answer

Install Hotjar via Google Tag Manager by copying your Hotjar tracking code from your dashboard and creating a new HTML tag in GTM. This method allows centralized management of your tracking scripts without modifying your website code directly.

Prerequisites

  • Active Google Tag Manager account
  • Hotjar account with tracking code access
  • Website admin access
  • Basic understanding of HTML tags

Step-by-Step Instructions

1

Get your Hotjar tracking code

Log into your Hotjar dashboard and navigate to Settings > Sites & Organizations. Select your site and click on Tracking Code. Copy the complete JavaScript tracking code that starts with <script> and ends with </script>.
Make sure you're copying the code for the correct site if you have multiple sites in your Hotjar account.
2

Access Google Tag Manager

Open Google Tag Manager in your browser and select the container for your website. Navigate to Tags from the left sidebar and click the New button to create a new tag.
3

Create a new HTML tag

Click on Tag Configuration and select Custom HTML from the tag type options. Give your tag a descriptive name like Hotjar Tracking Code in the tag name field at the top.
Use clear naming conventions to easily identify your tags later.
4

Add the Hotjar code

In the HTML text area, paste the complete Hotjar tracking code you copied earlier. Make sure the entire script is included, including the opening <script> and closing </script> tags.
Double-check that no characters were cut off when copying and pasting the code.
5

Configure the trigger

Click on Triggering and select All Pages trigger. This ensures Hotjar loads on every page of your website. If the trigger doesn't exist, create a new trigger by clicking the + button and selecting Page View > All Pages.
For specific page targeting, create custom triggers based on URL patterns instead of using All Pages.
6

Save and test the tag

Click Save to save your tag configuration. Use GTM's Preview mode by clicking the Preview button in the top right. Open your website in a new tab to test if the Hotjar tag fires correctly.
Check the browser's developer console for any JavaScript errors that might prevent Hotjar from loading.
7

Publish the changes

Once you've verified the tag works in preview mode, return to GTM and click Submit. Add a version name like Added Hotjar Tracking and description, then click Publish to make the changes live on your website.
Always test in preview mode before publishing to avoid breaking your website's functionality.
8

Verify installation in Hotjar

Return to your Hotjar dashboard and go to Settings > Sites & Organizations > Tracking Code. Wait a few minutes, then refresh the page. You should see a green checkmark indicating Hotjar is installed and working.
It may take up to 10 minutes for Hotjar to detect the installation, so be patient if you don't see confirmation immediately.

Common Issues & Troubleshooting

Hotjar not detecting installation after publishing GTM tag

Clear your browser cache and wait up to 10 minutes. Ensure the GTM container code is properly installed on your website and check that the Hotjar tag is firing in GTM's preview mode.

JavaScript console errors preventing Hotjar from loading

Check the browser console for errors. Common issues include missing semicolons in the tracking code or conflicts with other scripts. Verify you copied the complete tracking code from Hotjar.

Hotjar tag not firing in GTM preview mode

Check that your trigger is configured correctly and matches your website URLs. Ensure the All Pages trigger is selected and that your GTM container code is properly installed on the website.

Multiple Hotjar installations detected

Remove any hardcoded Hotjar tracking codes from your website HTML before implementing via GTM. Check for duplicate tags in GTM that might be loading Hotjar multiple times.

Prices mentioned in this guide are pulled from current plan data and may change. Always verify on the official Hotjar website before purchasing.