Skip to content
  • There are no suggestions because the search field is empty.

Integrating GA4 and GTM with HubSpot

Connect Google Analytics 4 to HubSpot

You can apply GA4 tracking to a single domain or all HubSpot-hosted domains. Domain-specific settings always take priority over default settings.

  1. In HubSpot, click the Settings icon in the top navigation bar.
  2. In the left sidebar, go to Content > Pages.
  3. Click the Choose a domain dropdown and select a domain — or choose Default settings for all domains to apply tracking site-wide.
  4. Click the Integrations tab.
  5. Under Tracking integrations, check Integrate with Google Analytics 4.
  6. Enter your GA4 Measurement ID in the field provided.
  7. Click Save.

To disconnect GA4, uncheck the same checkbox and save.


Connect Google Tag Manager to HubSpot

Once connected, GTM runs across all HubSpot-hosted content. Content hosted outside HubSpot must be connected to GTM separately.

  1. In HubSpot, click the Settings icon in the top navigation bar.
  2. In the left sidebar, go to Content > Pages.
  3. Click the Integrations tab.
  4. Check Integrate with Google Tag Manager.
  5. Enter your GTM Container ID (e.g. GTM-XXXXXXX).
  6. Click Save.

Add GTM Code Manually (Domain-Specific)

Use this if you only want GTM on specific domains rather than all HubSpot-hosted content. Requires access to your domain's header/footer HTML settings.

Step 1 — Copy your GTM snippets:

  1. Log in to Google Tag Manager.
  2. Click the Admin tab.
  3. Click the Container dropdown and select your container.
  4. Click Install Google Tag Manager.
  5. Copy both code snippets — (1) goes in the <head>, (2) goes immediately after the opening <body> tag.

Step 2 — Add snippets to HubSpot:

  1. In HubSpot, go to Settings > Content > Pages.
  2. Select the domain you want to track.
  3. Paste snippet (1) into the Head HTML field and snippet (2) into the Footer HTML field.
  4. Click Save.