How to Identify Google Analytics Code
Trying to find a Google Analytics tracking code on a website? Whether you're checking your own setup or doing a little competitive research, locating that small bit of code can feel like a scavenger hunt. This guide will walk you through a few simple and reliable methods to identify the Google Analytics code on any website, so you can get the information you need and move on with your day.
First, Which Google Analytics Code Are You Looking For?
Before you start digging, it's helpful to know what you're trying to find. Google has two main versions of Analytics, and their identification codes look a little different.
- Universal Analytics (UA): This is the older, recently sunsetted version. Many sites still have the code present, even if it's not collecting new data. The ID always starts with "UA-" followed by a series of numbers (e.g.,
UA-12345678-1). - Google Analytics 4: This is the current and primary version of Google Analytics. Its ID is called a "Measurement ID" and always starts with "G-" followed by a combination of letters and numbers (e.g.,
G-XYZ123ABC).
Knowing which format to search for makes the process much faster. Often, a website that has been around for a while might even have both codes installed as they transitioned from one system to the other.
Method 1: Check Inside Your Own Google Analytics Account
If you have administrative access to the Google Analytics account linked to your website, this is the most direct way to find your code. It’s the guaranteed source of truth for your own property.
Finding Your GA4 Measurement ID:
Finding your GA4 Measurement ID involves just a few clicks:
- Log in to your Google Analytics account.
- Click the 'Admin' gear icon in the bottom-left corner of the page.
- Once you are in the Admin panel, make sure the correct Account and Property are selected at the top.
- In the 'Property' column, click on 'Data Streams'.
- You'll see a list of your data streams (most websites will just have one). Click on the one for your website.
- On the next screen, you'll see your Measurement ID (G-...) right at the top right. This is the ID you need for integrations.
If you need the full script to install on your site, you can find it by scrolling down and clicking 'View tag instructions,' then selecting the 'Install manually' tab.
Finding a Universal Analytics Tracking ID:
If for some reason you still need to find your old UA code:
- In the Admin area, select the correct Universal Analytics property.
- In the 'Property' column, click on 'Tracking Info' and then 'Tracking Code'.
- Your Tracking ID (UA-...) and the global site tag (gtag.js) script will be displayed right on this page.
Method 2: Inspect a Website’s Page Source
This method works for any website, whether you own it or not. Every browser allows you to view the raw HTML that makes up a web page, and the Google Analytics script must be somewhere in that code to work. It might look intimidating, but you just need to search for one or two key phrases.
- Open the Website: Navigate to the home page (or any page) of the website you want to check.
- View the Source Code: Right-click anywhere on the page and select "View Page Source." This will open a new tab with the site's HTML. (Alternatively, you can press
Ctrl+Uon Windows orCmd+Option+Uon Mac). - Search the Code: Once the source code is open, use your browser's find function (press
Ctrl+ForCmd+F). Now, just search for one of the following identifiers:
You’ll likely find a piece of code that looks like this for GA4:
<-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XYZ123ABC"></script>
<script>
window.dataLayer = window.dataLayer || [],
function gtag(){dataLayer.push(arguments),}
gtag('js', new Date()),
gtag('config', 'G-XYZ123ABC'),
</script>
Method 3: Use a Simple Browser Extension
If digging through lines of HTML isn’t your cup of tea, a browser extension can do the work for you in seconds. These tools scan the website you're visiting and provide a clean list of all the tracking technologies they find.
Recommended Extensions:
- Google's Tag Assistant Companion: This is the official extension from Google for validating tracking tags. Simply install it, visit a web page, and click the extension's icon. It will pop up a window showing all the Google tags it found, including a "Google Analytics" tag with its corresponding "G-" or "UA-" ID.
- Wappalyzer: This is my personal favorite because it identifies all the technology on a website, not just Google tags. It can tell you the website’s CMS (like WordPress or Shopify), the marketing automation tools it uses, and of course, which analytics tool is installed. After installing it, just visit a site, click the Wappalyzer icon next to your address bar, and look under the 'Analytics' section.
- Dataslayer: This one is a little more advanced and primarily focused on debugging data layers for Google Tag Manager, but it clearly lists all detected tags and containers, including Google Analytics IDs.
Using an extension is arguably the fastest and easiest method, providing immediate results without having to inspect any code yourself.
When Your Code is Hidden Inside Google Tag Manager
Sometimes you’ll look at the page source and you won't find a G- or UA- ID anywhere. Instead, you might find a script that contains an ID starting with GTM-, like this:
<-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[],w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'}),var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'',j.async=true,j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl,f.parentNode.insertBefore(j,f),
})(window,document,'script','dataLayer','GTM-ABCDEFG'),</script>
This means the website is using Google Tag Manager (GTM) to manage its marketing and analytics scripts. GTM acts as a container, and the Google Analytics script is being 'injected' into the page from there, rather than being placed directly in the website's HTML.
So, how do you find the ID then?
- If it's your site: You'll need to log into your Google Tag Manager account, navigate to the "Tags" section, and find your Google Analytics tag. The GA4 Measurement ID or UA Tracking ID will be listed in the tag's configuration.
- If it's not your site: The easiest way is to use a browser extension like Google's Tag Assistant Companion. It can “look inside” the GTM container and show you all the tags that are firing, including the Google Analytics tag and its ID. It effectively uncovers what GTM is doing behind the scenes.
Final Thoughts
Whether you’re troubleshooting your own website or analyzing a competitor, knowing how to quickly find a Google Analytics code is an essential skill. You can access it directly in your own account, inspect a site's source code to search for specific identifiers, or use a convenient browser extension to do the heavy lifting for you.
Once you've confirmed your Google Analytics is set up correctly, you’re ready to start pulling insights. But jumping between platforms and wrangling raw data can feel like a chore. This is where we designed Graphed to help. We connect directly to your Google Analytics, Google Ads, Shopify accounts and more, so you don’t have to manually pull reports. You can just ask questions in plain English - like, “Which landing pages have the highest conversion rate this month?” - and instantly get back dashboards and answers without ever having to navigate a complex reporting interface.
Related Articles
What SEO Tools Work with Google Analytics?
Discover which SEO tools integrate seamlessly with Google Analytics to provide a comprehensive view of your site's performance. Optimize your SEO strategy now!
Looker Studio vs Metabase: Which BI Tool Actually Fits Your Team?
Looker Studio and Metabase both help you turn raw data into dashboards, but they take completely different approaches. This guide breaks down where each tool fits, what they are good at, and which one matches your actual workflow.
How to Create a Photo Album in Meta Business Suite
How to create a photo album in Meta Business Suite — step-by-step guide to organizing Facebook and Instagram photos into albums for your business page.