How can you check if a website has Google Analytics by looking at the source code?
Detecting Google Analytics on a website by examining the page source involves searching for specific code snippets or identifiers associated with Google Analytics.
Here’s a step-by-step guide on how to do it:
- Open the Page Source: Right-click on the webpage and select “View Page Source” or press
Ctrl+U
(Windows) orCmd+Option+U
(Mac) to open the page’s source code. - Search for Google Analytics Tracking IDs: Use
Ctrl+F
(Windows) orCmd+F
(Mac) to open the search function and look for the following keywords:UA-
: Represents Universal Analytics tracking IDs. Example:UA-12345678-1
.G-
: Indicates Google Analytics 4 (GA4) tracking IDs. Example:G-1A2B3C4D5E
. - Look for Google Analytics Script Tags: Search for script tags that load Google Analytics scripts: <script async src=”https://www.google-analytics.com/analytics.js”></script>.
- Look for Google Analytics Cookies: Check if the website sets cookies like
_ga
,_gid
, or_gat
, which are associated with Google Analytics.