How to Add Heatmaps and Session Recordings With Google Tag Manager
Install heatmaps and session recordings through Google Tag Manager without touching your site's code—tag setup, triggers, consent configuration, and troubleshooting.
Marketers often can't wait for a developer sprint to add a script. If your site already has Google Tag Manager, you can add heatmaps and session recordings yourself in about ten minutes.
Table of Contents
- Before You Start
- Step-by-Step GTM Setup
- Choosing the Right Trigger
- Consent Mode and CMP Settings
- Testing With Preview Mode
- Troubleshooting
- Key Takeaways
Before You Start
- Publish access to the GTM container.
- A DeepSync project for your domain (free).
- Your tracking snippet from Settings → Install.
Native install is still better when possible
GTM adds a small delay before tags fire, so the very first moments of a page load may be missed. If you can add the script directly to your site's head, do that. Use GTM when you can't touch the code.
Step-by-Step GTM Setup
- In GTM, go to Tags → New.
- Choose Tag Configuration → Custom HTML.
- Paste the DeepSync loader snippet.
- Under Triggering, choose Initialization – All Pages if available, otherwise All Pages.
- Name it "DeepSync – Session Replay & Heatmaps" and Save.
- Click Submit → Publish.
Reference: Install via Google Tag Manager.
Choosing the Right Trigger
| Trigger | When to use |
|---|---|
| Initialization – All Pages | Best: fires earliest |
| All Pages (Page View) | Good default |
| DOM Ready / Window Loaded | Avoid—you'll miss early interactions |
| History Change | Not needed; DeepSync tracks SPA route changes itself |
Consent Mode and CMP Settings
If your container uses a consent management platform (OneTrust, Cookiebot, CookieYes, etc.):
- Decide which consent category DeepSync belongs to (often "analytics" or "statistics").
- Make sure the tag is allowed to fire under that category.
- If your DeepSync project is in consent-required mode, add a tag that calls the consent function when the visitor accepts. See cookie consent and session replay setup.
The most common GTM problem: the tag is blocked under a consent category, so it never loads—even for visitors who accepted.
Testing With Preview Mode
- Click Preview in GTM and open your site.
- Confirm the DeepSync tag shows under Tags Fired.
- Browse a few pages.
- Check Sessions in DeepSync.
Troubleshooting
- Tag fired but no sessions: Consent-required mode without a consent call. See no data.
- Tag not firing: Trigger or consent category blocking it.
- Sessions missing first seconds: Expected with GTM; move to a native install if it matters.
- Duplicate sessions: The snippet is installed both in GTM and in the site code. Remove one.
Key Takeaways
- GTM lets marketers install heatmaps and recordings without code changes.
- Use the earliest trigger available.
- Configure your consent platform so the tag can fire.
- Prefer native installs when you can.
Conclusion
Ten minutes in GTM and you'll be watching how real visitors use your site by the end of the day.
Frequently Asked Questions
Related articles
Stay in the loop
Get the latest insights on product analytics and user behavior delivered to your inbox.



