Skip to main content

Building an Agency Dashboard

This guide demonstrates how to use the Mindshare API to build a dashboard that allows agencies to manage multiple customers and view detailed insights for each one.

Dashboard Structure

Your agency dashboard will have two main screens:
  1. Customers List Screen - Overview of all your customers
  2. Customer Detail Screen - In-depth analysis with 6 key sections:
    • AI Visibility Score & Breakdown
    • Competitors Analysis
    • Queries Performance
    • Sources Analysis
    • Growth Trends
    • Strategic Recommendations

Screen 1: Agency Customers Overview

Display all customers under your organization with key information.

Endpoint: POST /get-organization-customers

Use this endpoint to populate your customers list. What you’ll display:
  • Customer ID
  • Customer name (clickable to open detail screen)
  • Created date
  • Last scan date
  • Next scheduled scan
  • Payment status (paying vs trial)
  • Quick action: “View Dashboard” button
Implementation Example:
async function loadCustomers(organizationID) {
  const response = await fetch('/get-organization-customers', {
    method: 'POST',
    headers: {
      'X-API-Key': 'your-api-key',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ organizationID })
  });
  
  const data = await response.json();
  
  // Render customer list with columns:
  // ID, NAME, CREATED, LAST SCAN, NEXT SCAN, STATUS
  return data;
}

Screen 2: Customer Detail Overview

When a user clicks on a customer, show a comprehensive overview with multiple sections.

Components Overview

Your customer detail screen should display:
  1. AI Visibility Score (large circular indicator)
  2. Score Breakdown by Query Group
  3. Competitors Analysis (ranking and bar chart)
  4. Recent Queries (which queries led to mentions)
  5. Sources (domains and articles)
  6. Growth Graph (trend over time)
  7. Strategic Recommendations (actionable insights for improvement)

Loading Customer Detail Screen Data

When a user clicks “View Dashboard” for a specific customer, you’ll need to load several endpoints in parallel to populate all sections.

Required Endpoints

To build the complete customer overview screen, you’ll need:
// First, get all query groups and find the latest execution
const queryGroups = await fetch('/get-customer-query-groups', {
  method: 'POST',
  headers: { 'X-API-Key': 'your-api-key', 'Content-Type': 'application/json' },
  body: JSON.stringify({ customerID: 4896 })
});

const data = await queryGroups.json();
const latestExecution = data.data[0].executions[0].id;

return { queryGroups: data.data, latestExecution };

Section Descriptions

AI Visibility Score

Calculate the overall visibility score by averaging the latest scores from all query groups using /get-customer-growth-stats and /get-customer-query-groups.

Competitors Analysis

Display ranking and bar chart of competitors using /get-companies-stats.

Queries Section

Show table of queries with mention status over different scan dates using /get-queries.

Sources Analysis

Display domains with categories, impact percentages, and trends using /get-domain-stats.

Growth Graph

Display line graph with toggle between “Per Scan” (individual scores) and “Overview” (30-day rolling averages) using /get-customer-growth-stats.

Strategic Recommendations

Display actionable insights organized by effort size, platform, and scope using /get-recommendations.

Summary

This use case demonstrates how to build an agency dashboard in two screens:
  1. Customers List - Using /get-organization-customers
  2. Customer Overview - Using:
    • /get-customer-query-groups (for latest execution)
    • /get-customer-growth-stats (for visibility score and growth graph)
    • /get-queries (for queries table)
    • /get-companies-stats (for competitors)
    • /get-domain-stats (for sources)
    • /get-recommendations (for strategic insights)
All endpoints can be called in parallel for optimal performance. For detailed endpoint documentation, see the Endpoints section.

Dashboard Architecture