HomeAI Agents & ChatbotsTrack brand mentions in ChatGPT and…

Track brand mentions in ChatGPT and Gemini with n8n

Track brand mentions in ChatGPT and Gemini with n8n









To track brand mentions in ChatGPT and Gemini with n8n, you need a workflow that asks each AI the questions your buyers ask, then checks whether your name comes up in the answer. Search is no longer the only front door: people ask an assistant “what is the best tool for X” and act on the shortlist it gives them. If that shortlist names your competitors and not you, you are losing deals in a place you cannot see. This guide builds a free workflow that runs weekly, sends a set of buyer-style prompts to both Gemini and ChatGPT, records whether your brand and your competitors are mentioned, logs every result to Google Sheets, and emails you a share-of-voice report. It takes about 40 minutes to build, or a couple of minutes with the template at the end.

What it does

Once a week the workflow runs a list of prompts you control, the kind a prospect would type before choosing a product like yours. It sends each prompt to Google Gemini and to OpenAI’s ChatGPT through their official APIs, reads both answers, and marks whether your brand name appears in each one. It does the same check for a list of competitors, so you see not just whether you showed up but who showed up instead.

Every prompt becomes a row in Google Sheets with the date, the question, a yes or no for each assistant, and which competitors were named. Because it appends rather than overwrites, the sheet becomes a visibility trend you can chart over months. At the end of the run you get one email: “Acme Analytics was mentioned in 3/4 Gemini answers (75%) and 1/4 ChatGPT answers (25%),” with the full table underneath.

This is the measurement layer of AEO, answer engine optimization, sometimes called generative engine optimization. You cannot improve what you do not measure, and until now brand visibility inside AI answers has been a blind spot. If you are new to n8n, start with how to set up n8n, then come back here.

Why it beats the default

The default is to open ChatGPT once, type a question, see that you are not mentioned, feel bad, and close the tab. That is a spot check, not a measurement. It is not repeatable, it is not logged, and it tells you nothing about whether things are getting better or worse.

A handful of paid AEO monitoring tools now exist, but they charge a monthly subscription, track a fixed prompt list, and keep the data inside their dashboard. This workflow costs cents to run, tracks exactly the prompts your buyers use, checks both major assistants in one pass, and writes to a sheet you own. You can add a provider, change the prompts, or widen the competitor list whenever you like, because the logic lives in your instance, not behind someone else’s paywall. For more ready-made AI workflows, see the best n8n AI agent templates and the full template library.

What you need

  • An n8n instance (Cloud or self-hosted, version 1.0 or newer).
  • A Google Gemini API key (the free tier is enough to start). Used as an HTTP Header Auth credential with header x-goog-api-key.
  • An OpenAI API key. Used as an HTTP Header Auth credential with header Authorization and value Bearer YOUR_KEY.
  • A Google account for Sheets and a Gmail account for the report email.
  • A blank Google Sheet with a header row matching the field names below.

Time: about 40 minutes from scratch, or under 5 minutes if you import the template and add your credentials.

Node-by-node list

Eight nodes: a schedule, a config node, two AI calls per prompt, a checker, and a fork that both logs and emails.

Weekly schedule (Mon 7am)
        |
   Prompts & config  (Code: your brand + competitors + prompt list)
        |
    Ask Gemini  ──►  Ask ChatGPT
                          |
                    Check mentions  (Code: does the brand appear?)
                       |            |
        Log to Google Sheets    Build digest
                                     |
                            Send digest email (Gmail)
  
  1. Weekly schedule (Schedule Trigger) fires every Monday at 7am.
  2. Prompts & config (Code) holds your brand, competitors, and prompt list, one item per prompt.
  3. Ask Gemini (HTTP Request) sends each prompt to the Gemini API.
  4. Ask ChatGPT (HTTP Request) sends the same prompt to the OpenAI API.
  5. Check mentions (Code) reads both answers and records the hits.
  6. Log to Google Sheets (Google Sheets) appends one row per prompt.
  7. Build digest (Code) rolls the rows into one summary.
  8. Send digest email (Gmail) emails you the report.

Step-by-step build

1. Add the weekly schedule

Add a Schedule Trigger, interval Weeks, every 1 week, day Monday, hour 7. Weekly is the right cadence: AI answers drift slowly, and a weekly reading is enough to catch a trend without burning API calls.

2. Set your brand, competitors, and prompts

Add a Code node. It emits one item per prompt so the rest of the workflow processes each question independently. Edit the three lists to match your business.

const BRAND = 'Acme Analytics';
const COMPETITORS = ['DataPulse', 'Insightly'];
const PROMPTS = [
  'What are the best analytics tools for a small ecommerce store?',
  'Which tools help a SaaS startup track marketing ROI?',
  'Recommend affordable business intelligence software for a small team.',
  'What is a good tool for automated weekly sales reports?'
];
return PROMPTS.map(p => ({ json: { prompt: p, brand: BRAND, competitors: COMPETITORS } }));
💡

Tip: Never put your brand name in a prompt. The point is to see whether the AI raises you unprompted. “Best CRM for real estate” is a good prompt; “Is Acme the best CRM” is not.

3. Ask Gemini

Add an HTTP Request node. Set method POST and URL to the Gemini endpoint. Under Authentication choose Generic Credential Type, then Header Auth, and create a credential with name x-goog-api-key and your Gemini key as the value. Set the body to JSON and paste this expression:

URL:  https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent

JSON body:
={{ JSON.stringify({ contents: [ { parts: [ { text: $('Prompts & config').item.json.prompt } ] } ] }) }}
📌

Note: Referencing $('Prompts & config').item instead of $json keeps the original prompt available even after the HTTP node replaces the item with the API response. n8n pairs the items automatically.

4. Ask ChatGPT

Add a second HTTP Request node, method POST, pointing at the OpenAI endpoint. Create a Header Auth credential with name Authorization and value Bearer followed by your OpenAI key. Body JSON:

URL:  https://api.openai.com/v1/chat/completions

JSON body:
={{ JSON.stringify({ model: 'gpt-4o-mini', messages: [ { role: 'user', content: $('Prompts & config').item.json.prompt } ] }) }}

5. Check for mentions

Add a Code node. It reads both answers, checks whether the brand and each competitor appear, and outputs one clean row per prompt.

const cfg = $('Prompts & config').item.json;
const brand = cfg.brand;
const competitors = cfg.competitors || [];

const txt = v => (v == null ? '' : String(v));
const gem = $('Ask Gemini').item.json;
const geminiText = txt(gem?.candidates?.[0]?.content?.parts?.[0]?.text);
const openaiText = txt($json?.choices?.[0]?.message?.content);

const has = (hay, needle) => hay.toLowerCase().includes(String(needle).toLowerCase());

return [{ json: {
  report_date: new Date().toISOString().slice(0, 10),
  prompt: cfg.prompt,
  brand: brand,
  gemini_mentioned: has(geminiText, brand) ? 'yes' : 'no',
  chatgpt_mentioned: has(openaiText, brand) ? 'yes' : 'no',
  competitors_in_gemini: competitors.filter(c => has(geminiText, c)).join(', '),
  competitors_in_chatgpt: competitors.filter(c => has(openaiText, c)).join(', '),
  gemini_excerpt: geminiText.slice(0, 300),
  chatgpt_excerpt: openaiText.slice(0, 300)
} }];

A single row looks like this:

{
  "report_date": "2026-08-24",
  "prompt": "What are the best analytics tools for a small ecommerce store?",
  "brand": "Acme Analytics",
  "gemini_mentioned": "yes",
  "chatgpt_mentioned": "no",
  "competitors_in_gemini": "DataPulse",
  "competitors_in_chatgpt": "Insightly, DataPulse"
}

6. Log to Google Sheets

Add a Google Sheets node, operation Append Row. Pick your document and sheet and set mapping to Map Automatically. Your header row should match the field names: report_date, prompt, brand, gemini_mentioned, chatgpt_mentioned, competitors_in_gemini, competitors_in_chatgpt, gemini_excerpt, chatgpt_excerpt.

7. Build the digest and email it

Add a Code node that collapses every row into one summary item, then a Gmail node to send it. Set the Gmail node’s Email Type to HTML and map subject and message from the digest.

const items = $input.all().map(i => i.json);
if (items.length === 0) return [];
const total = items.length;
const gemHits = items.filter(r => r.gemini_mentioned === 'yes').length;
const oaHits = items.filter(r => r.chatgpt_mentioned === 'yes').length;
const pct = n => Math.round((n / total) * 100);
// ... builds an HTML table + subject line, returns one item
return [{ json: { subject: 'AI visibility: ' + pct(gemHits) + '% Gemini / ' + pct(oaHits) + '% ChatGPT', html: html } }];

Save and activate. You now have a repeatable, logged reading of your brand’s visibility inside the two assistants your buyers use most.

Common mistakes

  • Naming your brand in the prompt. That guarantees a mention and measures nothing. Prompts must be neutral buyer questions.
  • Reading $json in the Check node for the Gemini answer. After the ChatGPT call, $json is the OpenAI response. Pull Gemini’s text with $('Ask Gemini').item.
  • Wrong header for the API key. Gemini wants x-goog-api-key; OpenAI wants Authorization: Bearer. Swapping them returns a 401.
  • Sheet headers that do not match. Automatic mapping keys off exact column names. A header of Gemini will not catch the field gemini_mentioned.
  • Substring false positives. A short brand name can match inside another word. If your brand is two or three letters, tighten the has() check to match whole words.

Cost at realistic volume

The workflow makes two API calls per prompt, plus one Sheets append and one email per run.

Service Usage per weekly run (15 prompts) Cost
Gemini API (gemini-2.5-flash) 15 calls Free tier covers it
OpenAI API (gpt-4o-mini) 15 calls ~$0.01 / run
Google Sheets 15 row appends Free
Gmail 1 email Free
n8n 1 execution / week Free self-hosted; ~4 executions/month on Cloud

Call it a few cents a month for a real, trended view of your AI visibility. The paid tools that do this start around thirty dollars a month for a fixed prompt list.

Get the AI visibility tracker template

The guide above is free to follow. If you would rather skip the build, the ready-to-import template drops all eight nodes and every script onto your canvas. Import it, add your Gemini, OpenAI, Google Sheets, and Gmail credentials, edit your brand and prompts, and your first report can run today. Want it installed and tuned to your market? Our done-for-you service sets it up end to end.

Download the template ($19) →

Instant download · Works on n8n Cloud and self-hosted

Frequently asked questions

Why track brand mentions in ChatGPT and Gemini at all?

More buyers now ask an AI assistant for recommendations before they ever reach Google. If ChatGPT and Gemini name your competitors and not you, you lose the sale before the research starts. This workflow turns that invisible risk into a number you can watch and improve.

Does this use the real ChatGPT and Gemini, or the public websites?

It calls the official OpenAI and Google Gemini APIs, not the chat websites. The API answers come from the same underlying models, they are stable to parse, and scripting them is allowed. Scraping the chat sites is against their terms and breaks constantly, so the API is the correct route.

How much does it cost to run each week?

Gemini has a free tier that covers a small prompt set, and gpt-4o-mini costs a fraction of a cent per prompt. A weekly run of ten to twenty prompts across both providers costs a few cents a month. The Google Sheets and Gmail steps are free.

Can I add Perplexity or Claude to the same report?

Yes. Duplicate the Ask Gemini node, point it at the other provider’s API, and add its result to the Check mentions node. The rest of the workflow does not change, so you can grow from two assistants to four without rebuilding anything.

What prompts should I track?

Use the questions a buyer would actually type before choosing a product like yours: best tool for X, affordable software for Y, alternatives to a competitor. Avoid prompts that name your brand, because the goal is to see whether the AI raises you on its own.

Related guides