Recipes

Build a GEO visibility dashboard

Aggregate /v1/check?mode=all_live across a query portfolio into a per-surface presence dashboard. Useful for executive reporting and spotting which AI surfaces are under-investing your content.

Code

javascript
import fetch from "node-fetch";

const QUERIES = ["best CRM for small business", "best CRM for startups", "free CRM"];
const BRAND = "HubSpot";

async function checkAllLive(query: string) {
  const res = await fetch("https://api.mentionsapi.com/v1/check", {
    method: "POST",
    headers: { Authorization: `Bearer ${process.env.MENTIONSAPI_KEY}`, "Content-Type": "application/json" },
    body: JSON.stringify({ mode: "all_live", query, brand: BRAND }),
  });
  return res.json();
}

async function snapshot() {
  const results = await Promise.all(QUERIES.map(checkAllLive));
  const surfaces = ["perplexity", "chatgpt", "gemini", "ai_overview", "ai_mode", "bing_copilot"];

  const presence: Record<string, { mentions: number; total: number; ranks: number[] }> = {};
  for (const s of surfaces) presence[s] = { mentions: 0, total: 0, ranks: [] };

  for (const r of results) {
    for (const s of surfaces) {
      const cell = r.providers[s];
      if (!cell) continue;
      presence[s].total++;
      if (cell.mentioned) {
        presence[s].mentions++;
        if (cell.rank !== null) presence[s].ranks.push(cell.rank);
      }
    }
  }

  return Object.entries(presence).map(([surface, p]) => ({
    surface,
    presence_rate: p.total > 0 ? (p.mentions / p.total) : 0,
    avg_rank: p.ranks.length > 0 ? p.ranks.reduce((a, b) => a + b, 0) / p.ranks.length : null,
    queries_with_mention: p.mentions,
  }));
}

console.table(await snapshot());

Sample output

bash
┌──────────────┬──────────────┬─────────┬─────────────────┐
│ surface      │ presence_rate│ avg_rank│ queries_w_mention│
├──────────────┼──────────────┼─────────┼─────────────────┤
│ perplexity   │ 1.00         │ 5.3     │ 3               │
│ chatgpt      │ 1.00         │ 4.0     │ 3               │
│ gemini       │ 0.67         │ 5.5     │ 2               │
│ ai_overview  │ 1.00         │ 3.0     │ 3               │
│ ai_mode      │ 1.00         │ 2.3     │ 3               │
│ bing_copilot │ 0.67         │ 4.0     │ 2               │
└──────────────┴──────────────┴─────────┴─────────────────┘

Cost

3 queries × $0.50 = $1.50 per snapshot. Run weekly: $6/month for a 6-surface, 3-query dashboard. Scale up the query list to whatever your portfolio is — cost scales linearly.