How OpenSEO Tracks AI-Generated Content Visibility Across ChatGPT and Google AI Overview
OpenSEO tracks AI-generated content visibility by integrating the DataForSEO AI Optimization API to monitor brand mentions across large language model platforms including ChatGPT and Google AI Overview, aggregating four specialized data endpoints into a unified cross-platform visibility score.
The every-app/open-seo repository implements a multi-layered architecture to discover and rank how domains appear in AI-generated responses. By leveraging TanStack React-Start server functions, Zod schema validation, and typed API clients, the codebase transforms raw LLM mention data into actionable SEO insights that appear alongside traditional organic metrics.
The AI Visibility Tracking Architecture
OpenSEO implements a five-step pipeline that moves from client-side requests to normalized visibility data. Each layer validates inputs, enforces paid-plan gating, and delegates to specialized services that interface with external LLM data sources.
Client-Side Request Initiation
The process begins in src/client/features/ai-search/useAiSearchAccess.ts, where a TanStack React-Start hook initiates the brand lookup. This client code calls the lookupBrand server function, passing the target domain and projectId parameters validated against the brandLookupInputSchema defined in src/types/schemas/ai-search.ts.
Server Function Validation
The lookupBrand function in src/serverFunctions/ai-search.ts acts as the gatekeeper. It first validates the request schema using Zod, then enforces access control via assertPaidPlan. Once validated, it delegates to the getBrandLookup service method, ensuring only authorized users can query AI visibility data.
Service Orchestration Layer
The core logic resides in src/server/features/ai-search/services/brandLookup.ts. This service orchestrates four parallel API calls to DataForSEO's AI Optimization endpoints, aggregating the results into a single coherent response. The service normalizes raw metrics like ai_search_volume and handles null-coalescing to ensure consistent data formatting.
DataForSEO API Client
Low-level HTTP communication is abstracted in src/server/lib/dataforseo/ai.ts. This module exports four specialized functions: fetchLlmMentionsSearch, fetchLlmAggregatedMetrics, fetchLlmTopPages, and fetchLlmCrossAggregatedMetrics. Each function handles request signing with API credentials, error classification, and response parsing into typed TypeScript objects.
The Four Data Endpoints for LLM Visibility
OpenSEO queries four distinct DataForSEO endpoints to build a complete picture of AI-generated content visibility:
-
mentionsSearch – Retrieves raw LLM mentions of the target domain across platforms like ChatGPT, Google AI Overview, and Bing Chat, returning metrics such as
ai_search_volume. -
aggregatedMetrics – Calculates totals across all platforms, including total mention counts and estimated traffic values.
-
topPages – Identifies the most frequently cited URLs from the domain within LLM responses, enabling page-level visibility analysis.
-
crossAggregatedMetrics – Generates a cross-platform summary that powers the overall visibility score displayed in the dashboard.
Implementation: Fetching AI Visibility Data
The following examples demonstrate the client-server flow for retrieving AI visibility metrics.
Client-Side React Hook
// src/client/features/ai-search/useAiSearchAccess.ts
import { useQuery } from '@tanstack/react-query';
import { lookupBrand } from '@/serverFunctions/ai-search';
function useBrandAiVisibility(projectId: string, domain: string) {
return useQuery(
['aiVisibility', projectId, domain],
async () => {
// Calls the server function with validated parameters
const result = await lookupBrand({ projectId, domain });
return result; // { mentions, aggregatedMetrics, topPages, crossAggregatedMetrics }
},
{ enabled: !!projectId && !!domain }
);
}
Server-Side Service Implementation
// src/server/features/ai-search/services/brandLookup.ts
import {
fetchLlmMentionsSearch,
fetchLlmAggregatedMetrics,
fetchLlmTopPages,
fetchLlmCrossAggregatedMetrics
} from '@/server/lib/dataforseo/ai';
export async function getBrandLookup({ projectId, domain }, ctx) {
// Parallel execution of all four AI optimization endpoints
const [mentions, agg, top, cross] = await Promise.all([
fetchLlmMentionsSearch({ domain }),
fetchLlmAggregatedMetrics({ domain }),
fetchLlmTopPages({ domain }),
fetchLlmCrossAggregatedMetrics({ domain })
]);
// Normalise and combine into unified response
return {
mentions,
aggregatedMetrics: agg,
topPages: top,
crossAggregatedMetrics: cross,
};
}
API Client Configuration
The DataForSEO client in src/server/lib/dataforseo/ai.ts manages authentication and payload construction:
// Handles request signing, SSL, and response typing
const mentions = await fetchLlmMentionsSearch({ domain });
// Returns structured data including ai_search_volume per platform
Summary
OpenSEO tracks AI-generated content visibility through a robust integration with the DataForSEO AI Optimization API. Key implementation details include:
- Server-function architecture using TanStack React-Start with paid-plan gating in
src/serverFunctions/ai-search.ts. - Four specialized endpoints (
mentionsSearch,aggregatedMetrics,topPages,crossAggregatedMetrics) that capture platform-specific LLM data from ChatGPT and Google AI Overview. - Service orchestration in
src/server/features/ai-search/services/brandLookup.tsthat parallelizes requests and normalizes responses. - Type-safe API client at
src/server/lib/dataforseo/ai.tshandling authentication and error classification. - Zod schema validation ensuring type safety across the client-server boundary.
Frequently Asked Questions
What API does OpenSEO use to track AI content visibility?
OpenSEO integrates the DataForSEO AI Optimization API to discover and aggregate mentions of domains within large language model responses. This API provides specialized endpoints for ChatGPT, Google AI Overview, and other LLM platforms, which the src/server/lib/dataforseo/ai.ts client consumes to build visibility reports.
How does OpenSEO aggregate data from different LLM platforms?
The getBrandLookup service in src/server/features/ai-search/services/brandLookup.ts queries four distinct endpoints in parallel using Promise.all(). It then normalizes metrics like ai_search_volume and merges platform-specific fields into a unified JSON structure that powers cross-platform visibility scores.
What file handles the DataForSEO API authentication?
Authentication and request signing are managed in src/server/lib/dataforseo/ai.ts. This module constructs HTTP payloads, attaches API credentials, and parses responses into typed TypeScript objects before returning them to the brand lookup service.
Can OpenSEO track specific page-level AI visibility?
Yes. The fetchLlmTopPages endpoint retrieves the most-cited URLs from a specific domain within LLM responses. This data enables users to identify which individual pages receive the most AI-generated traffic, complementing domain-level metrics with granular page-specific insights.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →