This article steps through how to install your Hotjar tracking code on your Shopify storefront.
- How to install Hotjar on your Shopify storefront
- How to install Hotjar on your Shopify order status page
How to install Hotjar on your Shopify site
Hotjar won't work in Shopify sandbox environments
If the Hotjar tracking code is installed in a Shopify sandbox environment, no data will be collected and Ask tools won't display.
This also prevent any tracking of the checkout pages and is due to Shopify's security measures around what data is made available within the sandbox.
To learn more, visit Shopify's Help Center article: Sandbox Pixel Limitations
Go to your Hotjar Sites page and click on Install tracking code for your site.
Click on Add code manually.
Click on Copy to copy the Tracking Code to your clipboard.
Visit your Shopify Admin dashboard.
Click on Online Store, then click on Themes.
On your current theme, click on Actions and then select Edit code.
Within the Layout folder, click on theme.liquid.
Scroll down the theme.liquid page until you've found the </head> closing tag.
Some themes will use a variation of the <head> </head> tags such as {/head}, [/header], or other variations of [/head]. These all work in the same way.
Paste your Hotjar Tracking Code just before the closing </head> tag.
Click on Save to apply the changes.
How to install Hotjar on your Shopify order status page
Hotjar won't work for the order status page when using the Shopify Checkout Extensibility upgrade
Upgrading to Checkout Extensibility for the order status page means that Hotjar won't be able to work anymore due to Shopify's limitations for Pixels that run inside Checkout Extensibility pages.
To install the Tracking Code on your order status page, inside the Shopify Admin sidebar click on Settings.
Click on Checkout.
Scroll down until you reach the Order status page scripts section. Paste the Hotjar Tracking Code in the text field.
Click Save.
The Hotjar Tracking Code should now be installed on your order status page. This does not install the Tracking Code on your Shopify checkout, as Shopify's built-in checkout doesn't allow third-party scripts, such as Hotjar.
Having trouble installing the Hotjar Tracking Code?
Visit our articles on How to Check That Hotjar Is Working and Troubleshooting FAQS for Tracking Code Installation for troubleshooting guidance.