# Analytics & Search Console Setup — SEO for Developers

Source: https://www.geekswithgeeks.com/en/seo-developers/seo-analytics-setup

> Set up tools to track SEO performance and understand user behavior.

## Why analytics matter

**Google Analytics** tracks user behavior: traffic sources, pages visited, bounce rate, conversions. **Google Search Console** shows search queries, impressions, clicks, and ranking positions. Together, they tell you what's working and what needs fixing.

## Google Analytics 4 setup

Add the Google Analytics tag to every page. This tracks all user interactions.

```html
<!-- Google Analytics 4 (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');
  
  // Track custom events
  gtag('event', 'page_view');
  gtag('event', 'login', {method: 'google'});
</script>

<!-- Verify with Google Search Console -->
<meta name="google-site-verification" content="xxxxxxxxxxxxx">
```
