Can You Have 2 Google Analytics Codes on a Site?

Cody Schneider

Running two Google Analytics codes on a single website isn't just possible - it's surprisingly common and useful in certain situations. While it might sound like something that would break your tracking, modern Google Analytics is built to handle this exact scenario. This guide explains why you might need multiple tracking codes and walks you through exactly how to set them up without causing any issues.

The Short Answer: Yes, But Why Would You?

You can absolutely install more than one Google Analytics property on the same website, sending the same pageview and event data to two or more separate places. The key is in the setup. Done correctly, it's perfectly safe and won't inflate your metrics or cause major conflicts.

But before we get into the "how," let's talk about the "why." You shouldn't add extra tracking just for the sake of it, as it adds a layer of complexity. However, there are several practical scenarios where dual tracking is the perfect solution.

Common Reasons for Dual Tracking

1. Working with a Marketing Agency or Contractor

This is easily the most frequent reason. When you hire an SEO firm, a PPC agency, or a freelance marketer, they'll often want to track your website's performance in their own Google Analytics account. This allows them to:

  • Keep data organized: They manage dozens of clients. Having each client's data inside their own GA account, often linked to their Google Ads manager account, keeps everything streamlined.

  • Use their own setup: An agency may have specific event tracking, conversions, or filtering conventions they apply to all clients for consistent reporting in their Looker Studio (formerly Data Studio) dashboards.

  • Maintain access control: It gives them the data they need without you having to grant them high-level admin access to your company's primary analytics property.

In this setup, your site sends data to both your permanent GA4 property and their agency-specific GA4 property. If you part ways, they can simply be removed from your site's code or Google Tag Manager, and their data collection stops without disrupting your historical data.

2. Managing Parent and Subsidiary Companies

Imagine a large corporation that owns several smaller brands, each with its own website. The parent company might want a "roll-up" property that collects high-level data from all subsidiaries combined. This gives them a bird's-eye view of total traffic, overall user engagement, and marketing ROI across the entire portfolio.

At the same time, each subsidiary brand needs its own separate Google Analytics property to analyze its unique audience, track its specific marketing campaigns, and measure its progress toward individual goals. To achieve this, each subsidiary website would be tagged with two GA4 codes: one sending data to its individual property and another sending it to the parent company's roll-up property.

3. The Universal Analytics to GA4 Migration

A more historical, but very telling, example was the sunset of Universal Analytics (UA) in 2023. Ahead of the deadline, Google’s official recommendation was to run both the old UA tracking code and the new GA4 tracking code simultaneously. This practice of "dual tagging" allowed website owners to:

  • Continue collecting data in their familiar UA property, which had years of historical data.

  • Start collecting data in the new GA4 property to build up a historical baseline before UA stopped processing hits.

  • Compare the data models and ensure event tracking was configured correctly in GA4 before making it the source of truth.

Running both tags concurrently was the safest way to transition, ensuring no data was lost while providing a runway to adapt to the new GA4 interface and data structure.

How to Implement Two Google Analytics Codes Correctly

Adding a second tracking code is straightforward, but the best method depends on how your analytics is currently managed. Using Google Tag Manager (GTM) is the most flexible and recommended approach, but you can also do it by adding the gtag.js script directly to your website’s HTML.

Method 1: Using Google Tag Manager (Recommended)

If you're not already using Google Tag Manager, you should be. It’s a free tool that acts as a container for all your marketing and analytics tags, allowing you to add, edit, and remove them without having to edit your website's code directly. It's the cleanest and most scalable way to manage multiple GA4 properties.

Here’s how to set it up:

  1. Log in to Google Tag Manager: Navigate to your GTM container for the website.

  2. Create the First GA4 Configuration Tag:

    • Go to Tags and click New.

    • Give it a descriptive name, like "GA4 Config - [Your Company Name]".

    • In the Tag Configuration section, select Google Analytics: GA4 Configuration.

    • Enter the Measurement ID for your first GA4 property (e.g., "G-XXXXXXXXXX"). You can find this in your Google Analytics account under Admin > Data Streams.

    • Leave the "Send a page view event when this configuration loads" box checked.

  3. Set the Trigger: In the Triggering section, select the Initialization - All Pages trigger. This ensures the tag fires first on every page, which is best practice for configuration tags. If you have an older setup, using the All Pages (Page View) trigger is also fine.

  4. Save the Tag: Click Save. You now have your first GA4 tag set up.

  5. Create the Second GA4 Configuration Tag: Now, just repeat the process for your second property.

    • Click New again in the Tags section.

    • Name this one clearly, for example, "GA4 Config - [Agency Name]".

    • Choose Google Analytics: GA4 Configuration again.

    • Enter the Measurement ID for your second GA4 property.

    • Attach the same Initialization - All Pages trigger.

    • Save this tag.

  6. Submit your changes: Click the blue Submit button in GTM, give your version a name (e.g., "Added Agency GA4 Tag"), and publish the container.

That’s it! GTM will now load both configurations on every page, and the pageview event will be sent to both GA4 properties automatically. Any other GA4 event tag you create in GTM (like a purchase or form submission event) can be configured to send data to one or both properties as needed, giving you granular control.

Method 2: Adding Code Directly to Your Site (gtag.js)

If you don't use GTM and prefer to edit your site’s HTML, you can still send data to two properties. The global site tag (gtag.js) is designed to handle this.

You probably already have a script that looks something like this in the <head> section of your HTML:

To send data to a second property, you don't need to add the entire script block again. You only need to add one more config line with the second Measurement ID.

The modified code would look like this:

When you add this second gtag('config', 'G-SECONDPROPERTY') command, the same pageview hit and all subsequent automatic and custom gtag events will be sent to both properties. Make sure this block is present on every page of your site where you want to track analytics.

Potential Pitfalls and Best Practices

While dual tagging is safe, it’s not without potential downsides if managed poorly. Keeping these best practices in mind will help you avoid headaches.

1. Site Performance Impact

The Pitfall: Every script you add to your site requires an external HTTP request, which can marginally increase page load time. While Google's tags are highly optimized and load asynchronously (so they don't block visual page content from loading), adding too many tags can eventually slow things down.

Best Practice: Use Google Tag Manager. It loads as a single script and then manages all the other tags within it. This is more efficient than including numerous individual script tags directly in your HTML. In most cases, the impact of two GA tags is negligible, but it's something to be aware of.

2. Management and Maintenance Overhead

The Pitfall: With two properties, you have two places to manage. If you decide to add a new conversion event, change a "user" property, or update filtering rules, you have to remember to do it in both places to maintain consistency. It's easy to update one and forget the other, leading to data discrepancies down the line.

Best Practice: Centralize your tag management in GTM. Events can be configured once and mapped to send data to both endpoints, reducing the risk of human error. It also pays to keep a simple tracking plan document that outlines what is being tracked and where it is being sent.

3. Defining the Source of Truth

The Pitfall: When you present a report in a meeting, are you using data from Property #1 or Property #2? If an agency filters out internal IP addresses but you don't, your traffic numbers will differ slightly. Slight variations in configuration can lead to different numbers and cause confusion about which data set is the "official" one.

Best Practice: Establish a primary "source of truth" property from the beginning. Typically, this is your own company's permanent GA property. Use it for all internal reporting and decision-making. The secondary property can then be used for its specific purpose (e.g., agency-side analysis), and any discrepancies can be explained by differences in configuration.

Final Thoughts

Yes, you can absolutely have two Google Analytics codes on your site, and now you know how to implement them correctly using Google Tag Manager or by adding a second config line to your gtag.js script. This is a powerful technique for collaborating with agencies or managing complex organizational structures, as long as you remain mindful of consistency and establish a single source of truth.

While installing multiple trackers is straightforward, the ultimate goal is always to get clear, unified insights. Often, the challenge isn't just collecting data but synthesizing it across platforms or accounts. At Graphed , we help you shortcut that process by securely connecting all of your marketing data sources - including multiple Google Analytics properties, Google Ads accounts, CRMs, and more. Instead of flipping between reports, you can ask questions like, "Create a dashboard showing our main property's conversion rate next to our agency's reported ROAS" in plain English and get a unified, real-time dashboard instantly.