How to Detect Google Analytics on Any Website: 5 Methods

April 6, 2026 · 10 min read

Google Analytics is the most widely deployed analytics tool on the web. Estimates put it on over 50% of all websites that use any analytics platform. Yet from the outside, there’s no obvious indicator—no badge, no footer text—that tells you whether a site is tracking with GA4, Universal Analytics, or neither.

Whether you’re auditing a competitor’s marketing stack, vetting a vendor’s data collection practices, or building a technographic dataset for sales prospecting, detecting Google Analytics is one of the most common and practical use cases for technology detection.

This guide covers five methods: from quick manual checks to a fully programmatic API approach that works at scale.

Why Detect Google Analytics on a Website

Competitive Intelligence

Knowing a competitor uses Google Analytics tells you they’re actively measuring traffic and conversions. If they’re running GA4 alongside Google Tag Manager, it signals a mature marketing operation with event tracking, conversion funnels, and likely Google Ads integration. A site with no analytics at all suggests a different level of sophistication. When you combine analytics detection with full tech stack detection, you get a much richer picture of how a company operates.

Privacy and Compliance Auditing

Google Analytics collects personal data (IP addresses, device fingerprints, browsing behavior). Under GDPR, CCPA, and similar regulations, organizations need to know which third-party scripts their vendors embed. Detecting GA on a partner’s site is part of vendor due diligence—especially in regulated industries where data sharing agreements are required.

Sales Prospecting

If you sell analytics tools, tag management services, consent management platforms, or competing products, knowing which sites already run Google Analytics is directly actionable. You can build prospect lists filtered by analytics tool, then enrich those leads with the rest of their JavaScript framework and infrastructure stack.

Method 1 — Check the Page Source for the GA Snippet

The simplest way to check if a website uses Google Analytics is to view the HTML source and search for the tracking script. In any browser, press Ctrl+U (or Cmd+Option+U on macOS) to view source, then search for one of these strings:

Identifying GA4 vs Universal Analytics

The snippet format tells you exactly which version is in use. GA4 uses a Measurement ID that starts with G-:

<!-- GA4 -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'G-XXXXXXXXXX');
</script>

Universal Analytics (now sunset, but still present on many sites) used a Tracking ID starting with UA-:

<!-- Universal Analytics -->
<script async src="https://www.google-analytics.com/analytics.js"></script>
<script>
  window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};
  ga('create', 'UA-XXXXXXX-X', 'auto');
  ga('send', 'pageview');
</script>

If you find a G- ID, the site is running GA4. If you find a UA- ID, they’re still using the legacy Universal Analytics code (which stopped processing data in July 2024). Some sites have both—a common transitional pattern during the GA4 migration.

VersionID PatternScript SourceStatus
GA4G-XXXXXXXXXXgoogletagmanager.com/gtag/jsActive
Universal AnalyticsUA-XXXXXXX-Xgoogle-analytics.com/analytics.jsSunset (Jul 2024)
Legacy ga.jsUA-XXXXXXX-Xgoogle-analytics.com/ga.jsDeprecated

Limitation: Viewing page source only shows scripts embedded in the initial HTML. If Google Analytics is loaded dynamically via JavaScript after page load (common with consent management platforms), it will not appear in the source. Methods 2 and 3 handle this case.

Method 2 — Use Chrome DevTools Network Tab

The Network tab captures every HTTP request the page makes, including scripts loaded dynamically after initial page render. This catches GA installations that the page source method misses.

  1. Open Chrome DevTools (F12 or Ctrl+Shift+I)
  2. Go to the Network tab
  3. Reload the page (Ctrl+R)
  4. In the filter bar, type google-analytics or googletagmanager

Filter for google-analytics.com and googletagmanager.com Requests

If the site uses GA4, you will see requests to these domains:

For Universal Analytics (legacy), the requests go to:

The Network tab is especially useful because it shows the actual data being sent. Click on a /g/collect request and examine the query parameters to see what events are being tracked, the Measurement ID, and other configuration details.

Tip: If a consent management platform is blocking analytics until the user consents, you need to accept cookies first. Reload the page after accepting, and the GA requests will appear. This is why the Network tab is more reliable than page source for sites with cookie consent banners.

Method 3 — Inspect the dataLayer Object in the Console

Google Tag Manager and GA4 both use a JavaScript array called dataLayer to pass data between the page and the tracking code. You can inspect it directly in the browser console.

Open DevTools (F12), go to the Console tab, and type:

> window.dataLayer
// If GTM/GA4 is present, you'll see an array like:
[
  { "gtm.start": 1712419200000, event: "gtm.js" },
  { event: "gtm.dom" },
  { event: "gtm.load" }
]

If window.dataLayer returns an array, the site is using Google Tag Manager or GA4. If it returns undefined, neither is present on the page.

You can also check for the GA4-specific global function:

> typeof window.gtag
// "function" if GA4 is loaded
// "undefined" if not

And for Universal Analytics:

> typeof window.ga
// "function" if Universal Analytics is loaded
// "undefined" if not

The console method is fast and definitive. If window.gtag exists, GA4 is running. If window.ga exists, Universal Analytics is running. Both can coexist on the same page.

Method 4 — Browser Extensions

Several browser extensions can detect Google Analytics without manual inspection. These work well for one-off checks when you want a quick answer.

Common options include:

Browser extensions are convenient for manual browsing, but they have limitations: they only work one page at a time, require you to actually visit the site, and cannot be integrated into automated workflows. For scanning hundreds or thousands of domains, you need an API.

Method 5 — Use the DetectZeStack API for Programmatic Detection

When you need to detect Google Analytics across a list of domains—for lead enrichment, market research, or monitoring—manual methods don’t scale. The DetectZeStack API detects Google Analytics (both GA4 and Universal Analytics), Google Tag Manager, and 7,200+ other technologies in a single request.

Quick Demo (No API Key Required)

Try it without signing up. The /demo endpoint is rate-limited to 20 requests per hour per IP, but requires no authentication:

$ curl -s "https://detectzestack.com/demo?url=hubspot.com" | jq '.'
{
  "url": "https://hubspot.com",
  "domain": "hubspot.com",
  "technologies": [
    {
      "name": "Google Analytics",
      "categories": ["Analytics"],
      "confidence": 100,
      "source": "http"
    },
    {
      "name": "Google Tag Manager",
      "categories": ["Tag managers"],
      "confidence": 100,
      "source": "http"
    },
    ...
  ],
  "categories": {
    "Analytics": ["Google Analytics"],
    "Tag managers": ["Google Tag Manager"],
    ...
  },
  "meta": {
    "status_code": 200,
    "tech_count": 24,
    "scan_depth": "full"
  },
  "cached": false,
  "response_ms": 845
}

The source: "http" field tells you this detection came from HTTP fingerprinting—the API found the GA tracking script in the page’s HTML and JavaScript, the same way you would with a manual page source check, but fully automated.

Single-URL Detection with /analyze

For production use, the /analyze endpoint supports higher rate limits and is available through RapidAPI:

$ curl -s "https://detectzestack.p.rapidapi.com/analyze?url=hubspot.com" \
  -H "X-RapidAPI-Key: YOUR_KEY" \
  -H "X-RapidAPI-Host: detectzestack.p.rapidapi.com" | jq '.'

The response returns every detected technology with confidence scores and source indicators. Google Analytics appears as a separate entry from Google Tag Manager, so you can distinguish between sites that use GA directly versus those loading it through GTM.

Batch Detection with /analyze/batch

To scan multiple domains in one request, use the /analyze/batch endpoint:

$ curl -s -X POST "https://detectzestack.p.rapidapi.com/analyze/batch" \
  -H "X-RapidAPI-Key: YOUR_KEY" \
  -H "X-RapidAPI-Host: detectzestack.p.rapidapi.com" \
  -H "Content-Type: application/json" \
  -d '{"urls": ["hubspot.com", "stripe.com", "shopify.com"]}' | jq '.'

The batch endpoint accepts up to 10 URLs per request and returns results for each domain. This is useful for building a spreadsheet of which prospects use Google Analytics versus competing analytics platforms like Matomo, Plausible, or Adobe Analytics.

Reading the API Response

The response structure makes it easy to filter for analytics-specific technologies:

Technology NameCategoriesWhat It Means
Google AnalyticsAnalyticsGA tracking code present (GA4 or Universal)
Google Tag ManagerTag managersGTM container loaded; may manage GA and other tags

Both technologies are detected via the "http" source, meaning the API found them through HTTP fingerprinting of the page’s HTML content and JavaScript references. The categories object in the response groups technologies by function, making it easy to check for all analytics tools at once.

GA4 vs Universal Analytics — How Detection Differs

Google sunset Universal Analytics in July 2024, but plenty of sites still have the old tracking code in their HTML. Here is how the two versions differ from a detection perspective.

GA4 loads from googletagmanager.com/gtag/js and sends data to google-analytics.com/g/collect. The configuration uses gtag('config', 'G-...'). The dataLayer array and window.gtag function are both present.

Universal Analytics loaded from google-analytics.com/analytics.js and sent data to google-analytics.com/collect (without the /g/ prefix). The configuration used ga('create', 'UA-...'). The window.ga function was present, but window.gtag was not (unless the site also ran GA4).

For programmatic detection, the distinction mostly doesn’t matter—both show up as “Google Analytics” in technology detection tools. But if you’re doing competitive intelligence and want to know whether a competitor has migrated to GA4, checking the Measurement ID prefix (G- vs UA-) in the page source is the way to confirm.

Common Detection Pitfalls

Server-Side Google Tag Manager

Server-side GTM (sGTM) is the biggest challenge for analytics detection. When a site deploys sGTM, the tracking requests are proxied through a first-party subdomain (e.g., sgtm.example.com) instead of going directly to google-analytics.com. The gtag.js script may also be served from this first-party domain.

From a detection standpoint, sGTM can hide the standard Google Analytics fingerprints:

Automated detection tools (including the DetectZeStack API) will detect standard GA implementations but may miss sGTM deployments if the site fully proxies all Google domains. This is a known limitation of HTTP fingerprinting. DNS-based detection does not help here because sGTM uses the site’s own domain.

Consent Management Platforms Blocking Scripts

GDPR consent banners can delay or prevent the loading of Google Analytics until the visitor explicitly opts in. If the visitor (or automated scanner) never consents, the GA script never loads and won’t be detected in the page HTML.

In practice, many consent implementations still load GTM unconditionally and only conditionally fire the GA tag based on consent state. In those cases, Google Tag Manager is detectable even if Google Analytics itself is consent-gated. The DetectZeStack API fetches pages without interacting with consent banners, so consent-gated GA tags may not always appear in results.

Practical tip: If the API detects Google Tag Manager but not Google Analytics on a site, it is very likely that GA is loaded through GTM but gated behind consent. The presence of GTM is a strong signal that analytics tracking is in place, even if the specific GA tag doesn’t fire on unconsented page loads.

Building a Google Analytics Detection Script in Python

Here is a practical example: scan a list of domains and identify which ones use Google Analytics, Google Tag Manager, or both.

import requests
import csv
import time

API_URL = "https://detectzestack.p.rapidapi.com/analyze"
HEADERS = {
    "X-RapidAPI-Key": "YOUR_KEY",
    "X-RapidAPI-Host": "detectzestack.p.rapidapi.com"
}

GA_NAMES = {"Google Analytics", "Google Tag Manager"}

domains = ["hubspot.com", "stripe.com", "shopify.com", "basecamp.com"]

with open("ga_audit.csv", "w", newline="") as f:
    writer = csv.writer(f)
    writer.writerow(["domain", "google_analytics", "google_tag_manager"])

    for domain in domains:
        resp = requests.get(API_URL, headers=HEADERS, params={"url": domain})
        data = resp.json()

        tech_names = {t["name"] for t in data.get("technologies", [])}
        has_ga = "Google Analytics" in tech_names
        has_gtm = "Google Tag Manager" in tech_names

        writer.writerow([domain, has_ga, has_gtm])
        print(f"{domain}: GA={'yes' if has_ga else 'no'}, GTM={'yes' if has_gtm else 'no'}")

        time.sleep(0.5)  # respect rate limits

This produces a CSV with a boolean column for each tool. For a more complete tutorial covering batch endpoints, error handling, and advanced filtering, see Detect Any Website’s Tech Stack with Python.

Conclusion and Next Steps

Detecting Google Analytics comes down to finding the tracking script in the page. For one-off checks, viewing the source and searching for gtag or google-analytics.com is the fastest approach. The DevTools Network tab and console inspection catch dynamically loaded scripts that the page source misses. Browser extensions add convenience for manual browsing.

For anything beyond a handful of sites—competitive analysis, vendor auditing, or building prospect lists—the DetectZeStack API automates the entire process. A single request returns Google Analytics, Google Tag Manager, and every other technology on the site, with structured output that feeds directly into your pipeline.

Get Your Free API Key

100 requests per month, no credit card required. Detect Google Analytics, GTM, and 7,200+ technologies.

Get Your Free API Key

Related Reading

Get API updates and tech detection tips

Join the mailing list. No spam, unsubscribe anytime.