Install analytics with Google Tag Manager
It takes about 5 minutes. Use this guide if your site already has Google Tag Manager: you add one tag, publish the container, and check that events are coming in.
Before you start
- Google Tag Manager must already be installed on your site.
- You need your HeyCatch project key. It starts with hck_pk_.
1. Find your project key
Your project key starts with hck_pk_. Before your first install is confirmed it sits on the Analytics, Install screen in the sidebar; once an install is confirmed it sits behind the gear icon in the top right of the Product page. Press Copy prompt, paste the text into a note and copy just the key, from hck_pk_ to its last character. If a full stop follows the key, leave it out.
2. Copy this code
Replace YOUR_PROJECT_KEY with your key and keep the quotes. This code looks different from our other guides on purpose: Tag Manager does not run the shorter version, so this one builds it in a way Tag Manager accepts.
<script>
(function () {
var s = document.createElement('script');
s.type = 'module';
s.textContent =
"import { analytics } from 'https://esm.sh/@heycatch/sdk@0.8.0';" +
"analytics.init({ projectKey: 'YOUR_PROJECT_KEY', requestBatching: false, install: { framework: 'gtm', agent: 'other' } });";
document.head.appendChild(s);
})();
</script>
3. Add a tag in Tag Manager
- Open your container in Google Tag Manager.
- Go to Tags and press New.
- Name it HeyCatch.
- Press Tag Configuration and choose Custom HTML.
- Paste the code.
- Press Triggering and choose Initialization - All Pages. The All Pages page view trigger works too.
- Press Save.
4. Publish the container
Press Submit in the top right, then Publish. Tags do not run on your site until the container is published.
5. Visit your live site
Open your live site in a normal browser and click around for a few seconds. Visits from bots, scripts and automated browsers are filtered out, so it has to be you, clicking.
6. Check in HeyCatch
Back in HeyCatch, on the screen where you copied the prompt, press "I've installed" within the next half hour. The check only counts events from the last 30 minutes, so do it straight after your visit.
Not seeing events?
- Did you publish the container? Saving the tag is not enough. Press Submit, then Publish.
- Is the key right? It starts with hck_pk_ and sits inside the quotes, with no extra spaces.
- Is the trigger on all pages? A trigger on one page leaves every other page untracked.
- Does your cookie banner block tags? Some consent tools hold back every tag until the visitor accepts. Accept cookies on your site, then click around.
Still stuck? Write to us in the chat and we will look at your site.
Good to know
If you later add your own events, put them into this same tag, after the init call. A second tag can fire before this one, and its event is lost.
Short links
Short links are a separate step. Each link needs one redirect rule on your site, from /i to /?utm_campaign=i for each letter you use. The Short links article explains the rule.