If you run a Shopify store, you can see what people bought but not why the rest left. Heatmaps and session recordings close that gap, and the quickest way to get them is to install Hotjar on Shopify — a ten-minute job on the storefront, plus one extra decision about the checkout that most guides published before 2025 get badly wrong.
This walkthrough covers the theme.liquid method, the Google Tag Manager alternative, what changed about checkout tracking, and how to fix the installation when Hotjar tells you the code is invalid.
What you get out of it
- Heatmaps show where people click, how far they scroll and what they ignore. On a product page this usually reveals that nobody reaches the size guide you spent a week on.
- Session recordings show individual journeys. Rage clicks on a non-clickable element, a variant picker that does nothing on mobile, a form that clears itself — these never show up in analytics, only in replays.
- On-site surveys ask the one question your data cannot answer: what stopped you from buying today.
- Bug spotting. A theme update that breaks the add-to-cart button on one browser is invisible in GA4 and obvious in a recording.
Hotjar is now part of Contentsquare, but the free tier and the setup below are unchanged.
Method 1: install Hotjar on Shopify through theme.liquid
This is the standard route and the one to use unless you already run Google Tag Manager. It puts the tracking code on every storefront page in about ten minutes. You need the Hotjar Tracking Code from your Hotjar dashboard — it is a short script containing your site ID.
Step 1. In your Shopify admin, open Online Store.

Step 2. Open Themes.

Step 3. On your live theme, open the Actions menu in the top right and choose Edit code.

Step 4. In the Layout folder, open theme.liquid.

Step 5. Find the closing head tag near the top of the file.

Step 6. Paste the Hotjar Tracking Code immediately before that closing head tag.

Step 7. Save. The code is now live on every storefront page that uses this layout.
Two things worth doing properly rather than quickly. Duplicate the theme and edit the copy first if the store is busy — a stray character in theme.liquid takes the whole storefront down. And remember that this only covers the theme you edited: if you switch themes later, or run a seasonal theme, the code does not travel with you.
Method 2: through Google Tag Manager
If GTM is already on the store, add Hotjar as a Custom HTML tag firing on All Pages instead of touching theme.liquid. It survives theme changes, it is easier to remove, and it keeps your scripts in one inventory.
The trade-off is load order: a tag fired through GTM starts slightly later than one hardcoded in the head, so very short sessions can go unrecorded. For heatmaps and recordings this rarely matters. For anything that must fire on the first paint, hardcode it.
The checkout: why old guides on how to install Hotjar on Shopify are wrong
Almost every guide to installing Hotjar on Shopify tells you to paste the tracking code into Settings, Checkout, Additional scripts (sometimes called Other Scripts) to cover the thank-you page. That field is gone.
Shopify sunset checkout.liquid and additional scripts for the Thank you and Order status pages on 28 August 2025. Script tags on those pages ended on the same date for Plus stores and on 26 August 2026 for everyone else. Both dates have now passed. Any snippet still sitting in that box is not running.
The replacement is Settings, Customer events, where you add a custom pixel. It is worth understanding the limitation before you plan around it: custom pixels run in a sandboxed environment without access to the page DOM, which is what heatmaps and session recordings need. In practice that means you can track checkout events this way, but you should not expect full recordings of the checkout itself on a standard plan. Shopify Plus stores using Checkout Extensibility have more options through checkout UI extensions.
If watching people fail at checkout is the actual goal, the realistic answer on a non-Plus store is to instrument everything up to the checkout button with Hotjar, and measure inside the checkout with Customer events plus your analytics. Treat anyone promising full checkout recordings on a Basic plan with suspicion.
Verify that you did install Hotjar on Shopify correctly
After saving, open your storefront in a normal browser window — not an incognito one with an ad blocker — and then check the Sites section of your Hotjar dashboard. Hotjar confirms the tracking code once it sees traffic.

When Hotjar says the installation is invalid
The most common causes, in the order worth checking:
- You edited a theme that is not published. The single most frequent cause. Shopify lets you edit any theme in the library; only the live one serves visitors.
- The site ID is wrong. If you manage several sites in Hotjar, it is easy to copy the snippet for the wrong one. Compare the numeric ID in the pasted code against the one in your Hotjar Sites list.
- The code sits outside the head. Pasted after the closing head tag, or inside a conditional block, it may not execute. It belongs immediately before the closing head tag.
- An ad blocker or privacy extension in your own browser is stopping the script from loading, so Hotjar never sees the pageview. Test in a clean profile.
- A consent banner is blocking it. If your cookie tool holds analytics scripts until consent is given, Hotjar will not fire until you accept. That is correct behavior, not a fault — but you have to accept to verify.
- Two copies of the code. Installed once in theme.liquid and again through GTM or an app, the duplicate can break detection and will certainly distort your data. Pick one method.
- You checked too soon. Verification needs an actual pageview. Load a storefront page, then refresh the Hotjar dashboard.
After you install Hotjar on Shopify: what to look at first
A tracking code on its own changes nothing. The first week is worth spending narrowly:
- Heatmap your top-selling product page and your highest-traffic collection page. Nothing else yet.
- Watch ten recordings of sessions that added to cart and did not buy. Ten is enough to spot a pattern; fifty is procrastination.
- Put one exit survey on the cart page with a single question.
- Write down what you expect to see before you look. The value of recordings is in being wrong about something.
If you want a broader view of the tooling before committing, we compared the options in Shopify heatmap apps for store conversions. And if the installation is fine but the store still is not converting, that is a conversion rate optimization problem rather than a tracking one — our team runs the analysis and the tests, not just the setup.
