ScavioScavio
ProductPricingDocs
Sign InGet Started
  1. Home
  2. Tutorials
  3. How to Track AI Citations vs. SEO Rankings
Tutorial

How to Track AI Citations vs. SEO Rankings

Measure the lag between Google ranking and appearance in AI engine citations. Build a tracking dashboard with Scavio AEO + SERP data.

Get Free API KeyAPI Docs

r/AIRankingStrategy confirms the 2026 pattern: AI engine citations lag SEO rankings by weeks to months. A page ranking in Google today will show up in ChatGPT, Claude, or Perplexity citations later. This tutorial builds the tracker that measures the lag.

Prerequisites

  • Python 3.10+
  • A Scavio API key
  • Postgres or DuckDB for time-series storage

Walkthrough

Step 1: Pull SERP rankings daily

Standard Google SERP snapshot per tracked keyword.

Python
import requests, os, datetime
API_KEY = os.environ['SCAVIO_API_KEY']

def serp_snapshot(keyword):
    r = requests.post('https://api.scavio.dev/api/v1/search',
        headers={'x-api-key': API_KEY},
        json={'query': keyword, 'num_results': 10})
    return [x['link'] for x in r.json().get('organic_results', [])]

Step 2: Pull AI Overviews citations

Google AI Overviews cite sources directly.

Python
def ai_overview_citations(keyword):
    r = requests.post('https://api.scavio.dev/api/v1/search',
        headers={'x-api-key': API_KEY},
        json={'query': keyword, 'include_ai_overview': True})
    ao = r.json().get('ai_overview', {})
    return ao.get('citations', [])

Step 3: Store both into a time-series

One row per (keyword, url, date, surface).

Python
import duckdb
db = duckdb.connect('citations.duckdb')
db.execute('CREATE TABLE IF NOT EXISTS citations(keyword TEXT, url TEXT, date DATE, surface TEXT)')

def record(keyword):
    today = datetime.date.today()
    for u in serp_snapshot(keyword):
        db.execute('INSERT INTO citations VALUES (?, ?, ?, ?)', (keyword, u, today, 'serp'))
    for c in ai_overview_citations(keyword):
        db.execute('INSERT INTO citations VALUES (?, ?, ?, ?)', (keyword, c, today, 'ai_overview'))

Step 4: Compute the citation lag

For each URL, measure days between first SERP rank and first AI citation.

Python
def lag_days(keyword):
    return db.execute('''
      SELECT url,
        MIN(CASE WHEN surface='serp' THEN date END) AS first_serp,
        MIN(CASE WHEN surface='ai_overview' THEN date END) AS first_ai
      FROM citations WHERE keyword=?
      GROUP BY url
    ''', (keyword,)).fetchall()

Step 5: Visualize the lag distribution

Expect a long tail: most URLs lag 30 to 90 days.

Python
# Plot with matplotlib or pipe into Superset
import statistics
def mean_lag(keyword):
    rows = lag_days(keyword)
    diffs = [(r[2] - r[1]).days for r in rows if r[1] and r[2]]
    return statistics.mean(diffs) if diffs else None

Python Example

Python
import os, requests
API_KEY = os.environ['SCAVIO_API_KEY']

def track(keyword):
    r = requests.post('https://api.scavio.dev/api/v1/search',
        headers={'x-api-key': API_KEY},
        json={'query': keyword, 'include_ai_overview': True})
    return {'serp': r.json().get('organic_results', []), 'ao': r.json().get('ai_overview', {})}

print(track('best ai web scraping tools 2026'))

JavaScript Example

JavaScript
const API_KEY = process.env.SCAVIO_API_KEY;
export async function track(keyword) {
  const r = await fetch('https://api.scavio.dev/api/v1/search', {
    method: 'POST',
    headers: { 'x-api-key': API_KEY, 'Content-Type': 'application/json' },
    body: JSON.stringify({ query: keyword, include_ai_overview: true })
  });
  const d = await r.json();
  return { serp: d.organic_results || [], ao: d.ai_overview || {} };
}

Expected Output

JSON
Time-series of SERP ranks vs AI citations per keyword. Mean citation lag visible, queryable per URL.

Related Tutorials

  • How to Audit YouTube Content for Spam Signals
  • How to Research Etsy Keywords with Scavio

Frequently Asked Questions

Most developers complete this tutorial in 15 to 30 minutes. You will need a Scavio API key (free tier works) and a working Python or JavaScript environment.

Python 3.10+. A Scavio API key. Postgres or DuckDB for time-series storage. A Scavio API key gives you 50 free credits on signup.

Yes. The free tier includes 50 credits on signup, which is more than enough to complete this tutorial and prototype a working solution.

Scavio has a native LangChain package (langchain-scavio), an MCP server, and a plain REST API that works with any HTTP client. This tutorial uses the raw REST API, but you can adapt to your framework of choice.

Related Resources

Best Of

Best API for Custom SEO Dashboards in 2026

Read more
Use Case

Track AI Citations vs Google Rankings

Read more
Use Case

AEO/GEO Citation Tracking Dashboard

Read more
Best Of

Best API for AEO Dashboard Builders in 2026

Read more
Glossary

AI Citation Delay

Read more
Solution

Track AI Overview Citations for Agency Clients

Read more

Start Building

Measure the lag between Google ranking and appearance in AI engine citations. Build a tracking dashboard with Scavio AEO + SERP data.

Get Free API KeyRead the Docs
ScavioScavio

Real-time search API for AI agents. Search every platform, not just Google.

Product

  • Features
  • Pricing
  • Dashboard
  • Affiliates

Developers

  • Documentation
  • API Reference
  • Quickstart
  • MCP Integration
  • Python SDK

Alternatives

  • Tavily Alternative
  • SerpAPI Alternative
  • Firecrawl Alternative
  • Exa Alternative

Tools

  • JSON Formatter
  • cURL to Code
  • Token Counter
  • All Tools

© 2026 Scavio. All rights reserved.

Featured on TAAFT
Terms of ServicePrivacy Policy