ScavioScavio
ProductPricingDocs
Sign InGet Started
  1. Home
  2. Tutorials
  3. How to Track ChatGPT Citations for Your Brand
Tutorial

How to Track ChatGPT Citations for Your Brand

Monitor which URLs ChatGPT cites for your target prompts and track share-of-citation over time using Scavio's ask endpoint.

Get Free API KeyAPI Docs

ChatGPT citations are the new organic rankings. If your domain is not in the 3-5 URLs ChatGPT cites for a prompt, you are invisible. This tutorial sets up a daily citation tracker that runs your target prompts, extracts cited URLs, and logs share-of-citation per domain over time.

Prerequisites

  • Python 3.10+
  • A Scavio API key
  • SQLite or Postgres for logs
  • A list of 10-50 target prompts

Walkthrough

Step 1: Define target prompts

Prompts your buyers are likely to ask ChatGPT.

Python
PROMPTS = [
  'best SERP API for AI agents 2026',
  'how to replace SerpAPI',
  'cheapest google search api'
]

Step 2: Query Scavio ChatGPT endpoint

Scavio forwards prompts to ChatGPT and returns the answer with structured citations.

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

def ask(prompt):
    r = requests.post('https://api.scavio.dev/api/v1/search',
        headers={'x-api-key': API_KEY},
        json={'platform': 'chatgpt', 'query': prompt})
    return r.json()

Step 3: Extract citations

Scavio returns a citations array with url and title per source.

Python
def extract_citations(response):
    return [c['url'] for c in response.get('citations', [])]

Step 4: Log to database

One row per prompt per day per citation.

Python
import sqlite3
conn = sqlite3.connect('citations.db')
conn.execute('CREATE TABLE IF NOT EXISTS citations (date TEXT, prompt TEXT, url TEXT)')

def log_citations(prompt, urls):
    for u in urls:
        conn.execute('INSERT INTO citations VALUES (date(\'now\'), ?, ?)', (prompt, u))
    conn.commit()

Step 5: Compute share-of-citation

Percent of prompts where your domain appears.

Python
def share_of_citation(domain):
    total = conn.execute('SELECT COUNT(DISTINCT prompt) FROM citations').fetchone()[0]
    hits = conn.execute('SELECT COUNT(DISTINCT prompt) FROM citations WHERE url LIKE ?', (f'%{domain}%',)).fetchone()[0]
    return hits / total if total else 0

Python Example

Python
import os, requests, sqlite3

API_KEY = os.environ['SCAVIO_API_KEY']
PROMPTS = ['best SERP API for AI agents 2026', 'how to replace SerpAPI']
conn = sqlite3.connect('citations.db')
conn.execute('CREATE TABLE IF NOT EXISTS citations (date TEXT, prompt TEXT, url TEXT)')

for p in PROMPTS:
    r = requests.post('https://api.scavio.dev/api/v1/search',
        headers={'x-api-key': API_KEY},
        json={'platform': 'chatgpt', 'query': p})
    for c in r.json().get('citations', []):
        conn.execute('INSERT INTO citations VALUES (date(\'now\'), ?, ?)', (p, c['url']))
conn.commit()
print('logged')

JavaScript Example

JavaScript
const API_KEY = process.env.SCAVIO_API_KEY;
const PROMPTS = ['best SERP API for AI agents 2026', 'how to replace SerpAPI'];

for (const p of PROMPTS) {
  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({ platform: 'chatgpt', query: p })
  });
  const data = await r.json();
  console.log(p, data.citations?.map(c => c.url));
}

Expected Output

JSON
Per-prompt citation list. Share-of-citation for your domain across 30 prompts, trended daily. Example: scavio.dev cited in 12/30 prompts = 40% share-of-citation.

Related Tutorials

  • How to Monitor Perplexity Citations per Source
  • How to Track Gemini AI Overview Citations
  • How to Build an AEO Dashboard

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. SQLite or Postgres for logs. A list of 10-50 target prompts. 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

Use Case

AEO Brand Visibility Monitoring

Read more
Use Case

Google AI Mode Brand Monitoring

Read more
Solution

AEO Monitoring Stack (DIY)

Read more
Best Of

Best Cross-Platform Brand Monitoring APIs in 2026

Read more
Best Of

Best LLM Visibility Measurement Tools (May 2026)

Read more
Solution

SaaS AEO Visibility Monitor

Read more

Start Building

Monitor which URLs ChatGPT cites for your target prompts and track share-of-citation over time using Scavio's ask endpoint.

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