How to Install Google Analytics & Tag Manager on HubSpot Websites
Google Analytics Google Tag Manager HubSpot Jan 22, 2025 10:29:54 AM Francisco Lacayo 5 min read

Integrating Google Analytics (GA4) and Google Tag Manager (GTM) with your HubSpot CMS is the fastest way to monitor your traffic, understand user behavior, and turbocharge your marketing strategy. This guide will take you step-by-step through the installation process.
What You’ll Need
Before getting started, ensure you have the following:
- A registered Google Analytics account
- Access to your HubSpot account with admin privileges
- Access to your Google Tag Manager account
1. Create Your Google Analytics Account
- Go to Google Analytics.
- Sign in with your Google account or create a new one.
- Once logged in, click Admin at the bottom-left of the dashboard.
- Click the "+ Create" and select "Account".
- Add your account and property details, and follow the prompts. You will be asked to set up your Data Stream.
✅ Done? Perfect. Your Google Analytics account is now live.
2. Locate Your Google Analytics Tracking Code
Your tracking code (GA4 measurement ID) is essential for linking Google Analytics to HubSpot. Here’s how to find it:
- From your Google Analytics dashboard, click on Admin.
- Under the Data collection and modification widget, select Data Streams and choose your website property.
- Copy your Measurement ID (it will look like "G-XXXXXXXXXX").
Pro tip: Keep this ID handy—you’ll need it in the next step.
3. Add Your Measurement ID to HubSpot
- Log in to your HubSpot account.
- Navigate to Settings by clicking the gear icon in the top-right corner.
- From the left-hand menu, go to Tools > Content > Pages > Integrations.
- In the "Choose a domain to edit" section, select the domain where you want to install GA4
- Scroll to the Google Analytics tracking section.
- Paste your GA4 Measurement ID into the field.
- Click Save, and you're done!
Congratulations! Your HubSpot website is now connected to Google Analytics.
4. Install Google Tag Manager on HubSpot
Step 1: Create a Google Tag Manager Account
- Go to Google Tag Manager.
- Click "Create Account."
- Enter your account name (usually your business name).
- Select your country.
- Under "Container Setup," enter your website domain as the container name.
- Choose the target platform: "Web" for most websites.
- Click "Create" and accept the terms and conditions.
Step 2: Create a Tag Manager Container
- After creating your account, you'll be prompted to set up a container.
- A container is where all your tags (scripts) will be stored.
- Google Tag Manager will provide you with a couple of code snippets (JavaScript) to install on your website.
Step 3: Install Google Tag Manager on HubSpot
- Copy the code snippets provided by Google Tag Manager.
- Log in to your HubSpot account.
- Go to Settings > Tools > Content > Pages > Templates.
- In the "Choose a domain to edit" section, select the domain where you want to install GTM
- Paste the first code snippet into the “Site Header HTML” section and the second snippet into the “Site Footer HTML” section.
- Save your changes.
Your Google Tag Manager is now integrated with your HubSpot website!
,
Final Check
Before you start gathering insights, confirm that your installation was successful:
- Open Google Analytics and look for active data streams under “Realtime” to see if visitors are being tracked.
- Use Google Tag Manager’s Preview Mode to test your tags.
Unlock the Power of Data-Driven Marketing
Your HubSpot website now has the tools to measure, analyze, and optimize traffic seamlessly.
Need help maximizing your setup? Contact our team!