Analytics

How to add Google Analytics or Google Tag Manager

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.

  1. Go to your TeleportHQ dashboard.
  2. On your project's card, click the ⋯ button, then click Project Settings. The project's settings page opens on its General tab.
The ⋯ menu of a TeleportHQ project card on the dashboard, with Project Settings highlighted
  1. In the SETTINGS menu on the left, click Custom Code.
  2. Under Google, paste your measurement ID into Analytics (placeholder Google Analytics ID). Or paste your container ID into Tag Manager (placeholder Tag Manager ID).
The Custom Code tab of a TeleportHQ project's settings page, with the Custom Code menu entry and the Google Analytics and Tag Manager fields highlighted
  1. Scroll down, below the Custom code box, and click Save Changes.
  2. 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:

  1. You clicked Save Changes, then published.
  2. The ID starts with G- (or GTM- for Tag Manager), with no spaces.
  3. You're looking at your live site, not the editor.
  4. 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.
Share

Related Articles

How to see who visits your site (Analytics)

In TeleportHQ, click Growth in the left sidebar, then Analytics, to see your published site's visitors, page views, traffic sources, countries, devices, most-viewed pages, clicks and returning visitors, for the last 24 hours, the last 7, 30 or 90 days or a custom range.

How to add a tracking pixel (Meta, TikTok, LinkedIn)

To add a Meta Pixel, TikTok Pixel, LinkedIn Insight Tag or any other tracking script to a TeleportHQ site, copy the code from the ad platform, open Project settings (the cog at the bottom of the left sidebar) → Custom code, paste it under Head, and publish; the code saves itself.

Does TeleportHQ analytics use cookies?

No. TeleportHQ's built-in visitor analytics never sets cookies and, apart from recent order numbers on store sites, stores nothing in visitors' browsers unless they accept your cookie banner; it records anonymous page views and clicks, doesn't keep IP addresses with visit records, and deletes detailed visit records after 90 days.

How to add a cookie consent banner

In TeleportHQ, click Cookie Consent in Elements → Primitives → Interactive to add a banner with Accept and Decline buttons and a link to your terms page; Google Analytics and Google Tag Manager wait for Accept, the banner works on websites and web apps alike, and for cookie categories you paste a consent tool's code into Project settings → Custom code.

How to add code to every page (head and body)

In the TeleportHQ editor, click the Project settings cog at the bottom of the left sidebar, open Data & code → Custom code, choose Head or Body and paste your script, style, meta or link tags; the code saves itself and runs on every page of your published site, but not on the editor canvas.

How to turn visitor analytics on or off and choose tracked pages

In TeleportHQ, open Growth, click the Growth Settings gear and flip the Visitor analytics switch, then publish so the change reaches your live site; Tracked pages below the switch lists the pages you want to record visits on.