DEV Community

Cover image for I built an engine to reverse-engineer ChatGPT, Gemini and Perplexity rankings
Eddie Glush
Eddie Glush

Posted on

I built an engine to reverse-engineer ChatGPT, Gemini and Perplexity rankings

We all know SEO is changing. I noticed that my own behavior had shifted—I wasn't Googling "best CRM for startups" anymore; I was asking ChatGPT and Perplexity.

But as a developer, this annoyed me. I have tools to track my rank on Google (Ahrefs, SEMrush), but I had zero visibility into whether ChatGPT/Gemini was recommending my product or my competitor's. I was flying blind.

So, I decided to build a command center to fix that.

The Solution: Answer Engine Optimization (AEO) I built a system I call the AI Command Center. Instead of tracking keywords on a static page, it treats LLMs like dynamic users.

It answers three questions:

Visibility: Does ChatGPT even know my brand exists?

Sentiment: When mentioned, is the context positive or negative?

The "Mystery Shopper": If I ask an unbiased agent to compare me vs. a competitor, who wins?

The Tech Stack I built this into my current .NET stack. Here is the architecture:

Backend: C# / .NET (WebForms & Async Handlers)

Database: SQL Server (storing JSON snapshots of AI conversations)

AI Layer: OpenAI GPT-4o (for analysis) + DataForSEO API (for live SERP/LLM data)

Frontend: Vanilla JS + Chart.js (kept it lightweight)

How the "Mystery Shopper" Works (The Cool Part) This is the feature I'm most proud of. I didn't just want to know if I ranked; I wanted to know why I was winning or losing.

I built a simulation engine that spins up an AI agent with a specific persona (e.g., "Savvy Buyer"). I feed it a prompt like:

"Act as an unbiased consumer. Compare [My Brand] vs [Competitor] based on trust, pricing, and reviews. Who would you buy from?"

The system captures the raw response, parses it, and stores the "Winner" and the "Reasoning" in the database.

Now, instead of guessing why my conversion rate dropped, I can see that ChatGPT/Gemini is telling users: "Competitor X is better because they offer a free trial." That is actionable data I can fix immediately.

The "Self-Healing" Code I took it one step further. If the AI says "I can't find pricing for this product," my system detects that specific failure.

It then triggers a Schema Generator that writes the correct JSON-LD Product schema, validates it, and (if allowed) injects it directly into the site header. It’s essentially self-healing SEO code.

I built Zyro, a platform to help businesses grow, and I realized that "Growth" in 2025 means winning the conversation inside the AI, not just the blue links on Google.

It was a fun challenge to wire up the "Live" APIs to get real-time data from ChatGPT, Gemini and Perplexity rather than just relying on static databases.

Try it out I'd love to hear what you think of the approach. If you want to run a simulation on your own site, I put it live here: [Link to Zyro.world]

Let me know if you have questions about the C# implementation or the prompt engineering!

Top comments (0)