SEO Monitoring & Analytics
Monitoring your SEO performance helps you identify issues early and measure the impact of optimizations. This lesson covers essential tools and metrics.
Google Search Console
Google Search Console (GSC) is essential for monitoring your site's search performance.
Verifying Your Site
Add verification to your Next.js app:
// app/layout.tsx
export const metadata: Metadata = {
verification: {
google: 'your-verification-code',
yandex: 'your-yandex-code',
},
}
This generates:
<meta name="google-site-verification" content="your-verification-code">
Key Reports to Monitor
Performance Report
- Queries - What people search to find your site
- Pages - Which pages get the most traffic
- Countries - Where your users are located
- Devices - Mobile vs desktop traffic
Coverage Report
- Valid pages - Successfully indexed
- Errors - Pages that couldn't be indexed
- Warnings - Pages with issues
- Excluded - Intentionally not indexed
Core Web Vitals Report
- Mobile and desktop performance
- URLs grouped by status
- Specific issues to fix
Sitemaps Report
- Submit your sitemap
- Monitor discovery and indexing
Common GSC Warnings
"Duplicate without canonical"
// Fix: Add canonical
export const metadata: Metadata = {
alternates: {
canonical: 'https://example.com/preferred-url',
},
}
"Crawled - not indexed"
- Improve content quality
- Add internal links
- Ensure page provides value
"Redirect error"
- Check redirect configuration
- Avoid redirect chains
Analytics Integration
Google Analytics 4
// app/layout.tsx
import Script from 'next/script'
export default function RootLayout({ children }) {
return (
<html>
<head>
<Script
src={`https://www.googletagmanager.com/gtag/js?id=${process.env.NEXT_PUBLIC_GA_ID}`}
strategy="afterInteractive"
/>
<Script id="google-analytics" strategy="afterInteractive">
{`
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${process.env.NEXT_PUBLIC_GA_ID}');
`}
</Script>
</head>
<body>{children}</body>
</html>
)
}
Vercel Analytics
For Vercel-hosted sites:
// app/layout.tsx
import { Analytics } from '@vercel/analytics/react'
export default function RootLayout({ children }) {
return (
<html>
<body>
{children}
<Analytics />
</body>
</html>
)
}
Key Metrics to Track
| Metric | What It Tells You |
|---|---|
| Organic traffic | Overall SEO success |
| Click-through rate (CTR) | Title/description effectiveness |
| Average position | Keyword rankings |
| Bounce rate | Content relevance |
| Pages per session | Site engagement |
| Conversion rate | Business impact |
Automated SEO Testing
Add SEO checks to your CI/CD pipeline:
// __tests__/seo.test.ts
describe('SEO', () => {
it('has required metadata', async () => {
const response = await fetch('http://localhost:3000')
const html = await response.text()
expect(html).toContain('<title>')
expect(html).toContain('<meta name="description"')
expect(html).toContain('<link rel="canonical"')
})
it('has Open Graph tags', async () => {
const response = await fetch('http://localhost:3000')
const html = await response.text()
expect(html).toContain('og:title')
expect(html).toContain('og:description')
expect(html).toContain('og:image')
})
})
Lighthouse CI
Run Lighthouse in CI/CD:
# .github/workflows/lighthouse.yml
name: Lighthouse CI
on: [push]
jobs:
lighthouse:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run Lighthouse CI
uses: treosh/lighthouse-ci-action@v10
with:
urls: |
https://your-site.com/
https://your-site.com/courses
budgetPath: ./lighthouse-budget.json
// lighthouse-budget.json
[
{
"path": "/*",
"timings": [
{ "metric": "largest-contentful-paint", "budget": 2500 },
{ "metric": "cumulative-layout-shift", "budget": 0.1 }
]
}
]
Setting Up Alerts
Search Console Email Alerts
Google sends emails for:
- Critical indexing issues
- Security problems
- Manual actions
Custom Monitoring
// Monitor for 5xx errors
export async function checkSiteHealth() {
const urls = [
'https://example.com',
'https://example.com/courses',
'https://example.com/blog',
]
for (const url of urls) {
const response = await fetch(url)
if (!response.ok) {
await sendAlert(`${url} returned ${response.status}`)
}
}
}
Third-Party SEO Tools
Free Tools
- Google Search Console - Essential, from Google
- Bing Webmaster Tools - Similar for Bing
- Google PageSpeed Insights - Performance testing
- Rich Results Test - Structured data validation
Paid Tools
- Ahrefs - Backlinks, keywords, competitor analysis
- Semrush - All-in-one SEO platform
- Moz Pro - Domain authority, link analysis
- Screaming Frog - Technical SEO audits
Weekly SEO Checklist
| Task | Frequency |
|---|---|
| Check Search Console for errors | Weekly |
| Review Core Web Vitals | Weekly |
| Monitor organic traffic trends | Weekly |
| Check for new 404s | Weekly |
| Review top queries/pages | Weekly |
| Test structured data | Monthly |
| Full site audit | Quarterly |
Summary
In this lesson, you learned:
- Setting up Google Search Console
- Integrating analytics (GA4, Vercel)
- Key SEO metrics to track
- Automated testing in CI/CD
- Setting up monitoring and alerts
- Third-party SEO tools
In the next lesson, we'll cover common SEO mistakes and how to avoid them.

