Tutorial

How to Track Brand Citations Across ChatGPT, Perplexity, Gemini

Daily citation tracking across AI engines. AI Overviews, Perplexity citations, ChatGPT browsing — same pattern, one search API.

AI search visibility tools track citations in ChatGPT, Perplexity, and Google AI Mode. This tutorial walks the DIY layer that pairs with any tracker — daily citation pulls into DuckDB for delta tracking.

Prerequisites

  • Python 3.10+
  • Scavio API key
  • DuckDB

Walkthrough

Step 1: Define brand keyword set

10-30 brand and category keywords.

Python
KEYWORDS = ['scavio', 'best mcp search server', 'tavily alternative', 'search api for ai agents']

Step 2: AI Overviews citations via Scavio

include_ai_overview surfaces the citation list.

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

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

Step 3: Reddit thread tracking

Reddit citations precede AI Overview citations.

Python
def reddit_mentions(q):
    r = requests.post('https://api.scavio.dev/api/v1/reddit/search',
        headers={'x-api-key': API_KEY}, json={'query': q}).json()
    return r.get('posts', [])

Step 4: Persist into DuckDB

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

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

for k in KEYWORDS:
    today = datetime.date.today()
    for c in ai_overview(k):
        db.execute('INSERT INTO citations VALUES (?, ?, ?, ?)', (k, 'ai_overview', c, today))
    for p in reddit_mentions(k):
        db.execute('INSERT INTO citations VALUES (?, ?, ?, ?)', (k, 'reddit', p['url'], today))

Step 5: Friday delta query

What's new vs last Friday?

Python
delta = db.execute('''
  SELECT keyword, surface, url
  FROM citations
  WHERE date >= current_date - INTERVAL 7 days
  AND url NOT IN (SELECT url FROM citations WHERE date < current_date - INTERVAL 7 days)
''').fetchall()

Python Example

Python
# See steps above. Daily run: 30 keywords × 2 calls = 60 credits = $0.26 on Project tier.

JavaScript Example

JavaScript
// Same pattern in TS with duckdb-async.

Expected Output

JSON
Daily citation log per surface. Friday delta email with new and lost citations per keyword.

Related Tutorials

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+. Scavio API key. DuckDB. A Scavio API key gives you 500 free credits per month.

Yes. The free tier includes 500 credits per month, 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.

Start Building

Daily citation tracking across AI engines. AI Overviews, Perplexity citations, ChatGPT browsing — same pattern, one search API.