How to add Google Analytics or Google Tag Manager
To connect Google Analytics 4 to your TeleportHQ site, go to your dashboard, open the project's ⋯ menu and click Project Settings. On the Custom Code tab, paste your Google Analytics measurement ID (it starts with G-) into Analytics, click Save Changes and publish. For Google Tag Manager, paste your container ID (it starts with GTM-) into Tag Manager instead. TeleportHQ adds Google's code to every page for you.
Before you start
- The Google fields are available on Trial, Pro and Premium. If the workspace's trial or subscription has ended, you see an Add Google Analytics card instead: "To benefit from Google Analytics and Google Tag Manager, upgrade your workspace."
- You need a role that can edit the project.
- You need a Google Analytics 4 property with a web data stream, or a Google Tag Manager container.
- Old Universal Analytics IDs (starting with
UA-) no longer collect data, because Google retired Universal Analytics. Use a Google Analytics 4 ID. - TeleportHQ also has its own visitor analytics, with no setup. You can use both. See How to see who visits your site (Analytics).
1. Find your ID in Google
Google Analytics 4: In Google Analytics, go to Admin → Data streams, click your website's stream, and copy the Measurement ID. It looks like G-A1B2C3D4E5.
Google Tag Manager: In Tag Manager, the container ID is shown at the top of your workspace. It looks like GTM-AB12CD3.
Google changes its screens from time to time, so the names above may differ slightly.
2. Add the ID to TeleportHQ
The Google fields are on the project's Project Settings page, which you open from the dashboard. The Project settings panel inside the editor doesn't have them: its Custom code entry only holds head and body code.
- Go to your TeleportHQ dashboard.
- On your project's card, click the ⋯ button, then click Project Settings. The project's settings page opens on its General tab.
- In the SETTINGS menu on the left, click Custom Code.
- Under Google, paste your measurement ID into Analytics (placeholder Google Analytics ID). Or paste your container ID into Tag Manager (placeholder Tag Manager ID).
- Scroll down, below the Custom code box, and click Save Changes.
- Open your project in the editor and publish your site. See How to publish your site.
Check that it worked
Open your published site in a browser. In Google Analytics, go to Reports → Realtime. Your own visit shows within a minute or two. For Tag Manager, use Tag Manager's Preview mode with your live address.
Google's code only runs on your published site, and in code you download. It doesn't run inside the TeleportHQ editor.
Troubleshooting
Google Analytics shows no data Check these in order:
- You clicked Save Changes, then published.
- The ID starts with
G-(orGTM-for Tag Manager), with no spaces. - You're looking at your live site, not the editor.
- Your browser's ad blocker isn't blocking Google Analytics.
"Invalid characters: < , > , { , }" You pasted the whole Google tag code instead of the ID. Paste only the ID, like G-A1B2C3D4E5. Save Changes stays greyed out until the field is fixed.
Visits are counted twice Your site loads Google Analytics twice. This happens if you entered the ID in Analytics and also pasted Google's tag code into the head or body code, or if your Tag Manager container already includes a Google Analytics tag. Keep only one.
I see an "Add Google Analytics" card instead of the fields The workspace's trial or subscription has ended. See What's the difference between Trial, Pro and Premium?.
I can't find Project Settings in the card's menu Your role can't change the project's settings. Ask the workspace owner or an admin.
Good to know
- Google Analytics uses cookies. Unlike TeleportHQ's built-in analytics, Google's code sets cookies. If your site has a TeleportHQ cookie banner, Google waits for the visitor's Accept: until then it runs in consent mode and sets no cookies. Without a banner, it loads with the page. Tags from other companies inside your Tag Manager container don't wait. See How to add a cookie consent banner and Does TeleportHQ analytics use cookies?.
- Online store events are sent automatically. When your project has a TeleportHQ store and Google Analytics or Tag Manager is set up, product views, add-to-cart, remove-from-cart, checkout and purchase events are sent to Google in the standard Google Analytics 4 format. This works even with TeleportHQ's own visitor analytics turned off.
- Other tracking tools, like the Meta Pixel, go in the head code. See How to add a tracking pixel (Meta, TikTok, LinkedIn).
- An ID you saved stays after a trial or subscription ends. The Google fields stay visible so you can edit or clear them.
- Leaving with unsaved changes. If you move to another tab or page before you click Save Changes, TeleportHQ asks "You have unsaved changes. Are you sure you want to leave?" Cancel, then click Save Changes.