How to fix: Google Analytics tracking ID exposed
A Google Analytics tracking ID (UA-XXXX or G-XXXX) was found in the page source. Analytics tracking IDs are public by design and must be present in the browser to work, but their exposure allows third parties to identify the analytics property.
Why it matters
Google Analytics tracking IDs are not secret by design. Their disclosure may allow a third party to send fake traffic or events to your analytics property (referrer spam), inflating metrics or triggering alerts. This does not expose user data or grant access to analytics reports, which are protected by Google account credentials.
The UA-XXXX (Universal Analytics) and G-XXXX (GA4) IDs must appear in page source for client-side tracking to function. Unlike API keys, they do not grant access to any backend service. The main concern is analytics spam from parties who find your tracking ID.
How to fix it
- 1This is informational: no immediate action required.
- 2Monitor your Google Analytics reports for unusual spikes in bot or referrer traffic.
- 3Use server-side analytics or the Measurement Protocol with API secrets to reduce client-side tracking ID exposure.
- 4Enable bot filtering in Google Analytics settings.
Code examples
Next.js (server-side analytics with GA Measurement Protocol)
// Server-side event: tracking ID not exposed in browser source
const GA_MEASUREMENT_ID = process.env.GA_MEASUREMENT_ID;
const GA_API_SECRET = process.env.GA_API_SECRET;
await fetch(
`https://www.google-analytics.com/mp/collect?measurement_id=${GA_MEASUREMENT_ID}&api_secret=${GA_API_SECRET}`,
{
method: 'POST',
body: JSON.stringify({ client_id: clientId, events: [{ name: 'page_view' }] }),
}
);References
Detected automatically by VulnRadar. The check id is ga-tracking-id-leaked, stable across every scan so you can filter or diff on it.
More info disclosure checks
- MediumRails Session Cookie Missing HttpOnly Flag
- InfoServer header truncated
- InfoPHP session cookie naming exposes runtime
- Infoconfig.js / settings.js referenced (verify contents)
- Infoenv.js / environment.js referenced (verify contents)
- InfoSitemap.xml publicly accessible
- InfoOpenAPI schema version exposed in URL
- LowCORS exposes internal CDN hostname
Questions
- How severe is Google Analytics tracking ID exposed?
- VulnRadar rates this info severity in the info disclosure category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id ga-tracking-id-leaked, which stays the same between runs so you can filter, diff, or gate CI on it.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.