> ## Documentation Index
> Fetch the complete documentation index at: https://docs.clickflow.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Analytics

> SEO performance dashboards, AI visibility tracking, and answer engine optimization data.

Analytics tools pull data from Google Search Console, Google Analytics, and ClickFlow's AI visibility monitoring. Dashboard tools query Google APIs and may take 10-30 seconds.

## platform\_get\_results\_overview

Get SEO performance data from Google Search Console — clicks, impressions, CTR, position, and page-level breakdown with comparison to the previous period.

### Parameters

| Name             | Type   | Required | Default      | Description                                                          |
| ---------------- | ------ | -------- | ------------ | -------------------------------------------------------------------- |
| `date_range`     | string | No       | `"30d"`      | `7d`, `30d`, `90d`, `180d`, `12m`, `ytd`                             |
| `content_filter` | string | No       | `"sitewide"` | `sitewide` (all pages) or `clickflow` (only ClickFlow-managed pages) |

### Response

```json theme={null}
{
  "hasOrgData": true,
  "performanceChartData": {
    "current": [
      { "date": "2026-03-01", "clicks": 510, "impressions": 16000, "ctr": 0.032 }
    ],
    "comparison": [
      { "date": "2026-02-01", "clicks": 480, "impressions": 15200, "ctr": 0.031 }
    ],
    "totals": {
      "clicks": 15230,
      "impressions": 482000,
      "ctr": 0.032,
      "position": 18.4,
      "events": 1205
    }
  },
  "allPages": [
    {
      "id": "1",
      "title": "Complete SEO Guide for 2026",
      "url": "/blog/seo-guide",
      "isClickFlow": true,
      "isUpdatedByClickFlow": false,
      "impressions": 8400,
      "clicks": 520,
      "ctr": 0.062,
      "position": 5.2,
      "keyEvents": 42,
      "impressionsPrev": 7200,
      "clicksPrev": 440,
      "ctrPrev": 0.053,
      "positionPrev": 6.1,
      "keyEventsPrev": 35
    }
  ],
  "decayingContent": {
    "count": 3,
    "pages": [
      { "url": "/blog/old-post", "clicks_change": -25.0, "ctr_change": -0.8, "impressions_current": 1200 }
    ]
  },
  "growingContent": {
    "count": 5,
    "pages": [
      { "url": "/blog/trending-topic", "clicks_change": 45.0, "ctr_change": 1.2, "impressions_current": 6800 }
    ]
  }
}
```

### Errors

| Error                                              | Cause                       |
| -------------------------------------------------- | --------------------------- |
| `{"hasOrgData": false, "error": "no_connections"}` | No GSC connected            |
| `{"hasOrgData": false, "error": "no_gsc_access"}`  | GSC permissions not granted |

### Usage

<Tabs>
  <Tab title="MCP">
    ```json theme={null}
    { "date_range": "90d", "content_filter": "clickflow" }
    ```
  </Tab>

  <Tab title="API">
    ```bash theme={null}
    curl "https://api.clickflow.com/v1/api/results-overview?date_range=90d&content_filter=clickflow" \
      -H "Authorization: Bearer cf_ak_your_key_here"
    ```
  </Tab>
</Tabs>

<Warning>Slow: queries Google APIs. May take 10-30 seconds.</Warning>

***

## platform\_get\_aeo\_data

Get Answer Engine Optimization data from Google Analytics — AI-referred traffic by platform (ChatGPT, Perplexity, etc.), sessions, key events, and page-level breakdown.

### Parameters

| Name             | Type   | Required | Default      | Description                              |
| ---------------- | ------ | -------- | ------------ | ---------------------------------------- |
| `date_range`     | string | No       | `"30d"`      | `7d`, `30d`, `90d`, `180d`, `12m`, `ytd` |
| `content_filter` | string | No       | `"sitewide"` | `sitewide` or `clickflow`                |

### Response

```json theme={null}
{
  "activePlatforms": ["chatgpt", "perplexity"],
  "chartData": [
    { "date": "2026-03-01", "chatgpt": 15, "perplexity": 8 },
    { "date": "2026-03-02", "chatgpt": 18, "perplexity": 6 }
  ],
  "platformTotals": [
    { "platform": "chatgpt", "sessions": 342 },
    { "platform": "perplexity", "sessions": 156 }
  ],
  "sparklineCards": [
    { "label": "AI Sessions", "value": "498", "change": 12, "sparkline": [380, 410, 450, 498] }
  ],
  "pages": [
    {
      "id": "page_001",
      "url": "/blog/seo-guide",
      "sources": ["chatgpt", "perplexity"],
      "sourceSessions": { "chatgpt": 62, "perplexity": 27 },
      "sessions": 89,
      "engaged": 71,
      "trend": "growing",
      "isClickFlow": true
    }
  ],
  "keyEventsByPlatform": [
    { "platform": "chatgpt", "label": "ChatGPT", "keyEvents": 28 }
  ],
  "trafficQuality": [
    {
      "metric": "Engagement Rate",
      "llmValue": "78%",
      "llmChange": 5.2,
      "organicValue": "62%",
      "organicChange": 1
    }
  ],
  "totalAiSessions": 498
}
```

### Errors

| Error                                    | Cause             |
| ---------------------------------------- | ----------------- |
| `"No Google Analytics connection found"` | GA4 not connected |

<Warning>Requires GA4 connection. Slow: may take 10-30 seconds.</Warning>

***

## platform\_get\_visibility\_rankings

Track how your brand appears across AI platforms (ChatGPT, Perplexity). Returns brand mentions, average position, visibility percentage, and competitor rankings.

### Parameters

| Name          | Type    | Required | Default | Description                                      |
| ------------- | ------- | -------- | ------- | ------------------------------------------------ |
| `platform`    | string  | No       | `""`    | Filter: `chatgpt`, `perplexity`, or omit for all |
| `include_all` | boolean | No       | `false` | Include untracked competitors                    |

### Response

```json theme={null}
{
  "runId": "abc123",
  "completedAt": 1711234567890,
  "totalPrompts": 35,
  "brand": {
    "mentions": 24,
    "avgPosition": 3.2,
    "visibility": 68,
    "positionChange": -0.4,
    "visibilityChange": 5
  },
  "rankings": [
    {
      "competitorId": "comp_456",
      "name": "Competitor Inc",
      "domain": "competitor.com",
      "tracked": true,
      "mentions": 18,
      "avgPosition": 4.1,
      "visibility": 51,
      "positionChange": 0.3,
      "visibilityChange": -2
    }
  ],
  "platformBreakdown": [
    {
      "platform": "chatgpt",
      "brandVisibility": 72,
      "competitorVisibility": { "comp_456": 48 }
    }
  ]
}
```

### Usage

<Tabs>
  <Tab title="MCP">
    ```json theme={null}
    { "platform": "chatgpt", "include_all": true }
    ```
  </Tab>

  <Tab title="API">
    ```bash theme={null}
    curl "https://api.clickflow.com/v1/api/visibility/rankings?platform=chatgpt&include_all=true" \
      -H "Authorization: Bearer cf_ak_your_key_here"
    ```
  </Tab>
</Tabs>

***

## platform\_get\_visibility\_topics

Get topic-by-topic AI visibility scores with per-prompt breakdown.

### Parameters

| Name              | Type    | Required | Default | Description                     |
| ----------------- | ------- | -------- | ------- | ------------------------------- |
| `platform`        | string  | No       | `""`    | Filter: `chatgpt`, `perplexity` |
| `date_range_days` | integer | No       | `0`     | `7`, `30`, `90`, or `180`       |

### Response

```json theme={null}
{
  "runId": "abc123",
  "completedAt": 1711234567890,
  "topics": [
    {
      "topicId": "topic_789",
      "topicName": "SEO tools",
      "score": 72,
      "mentionedCount": 8,
      "totalCount": 12,
      "rankedInCount": 6,
      "yourPosition": 3.5,
      "change": 2,
      "competitorRankings": [
        {
          "competitorId": "comp_456",
          "avgPosition": 4.2,
          "name": "Competitor Inc",
          "domain": "competitor.com",
          "tracked": true,
          "promptCount": 5
        }
      ],
      "prompts": [
        {
          "promptText": "What are the best SEO tools?",
          "type": "mention",
          "yourPosition": 2.0,
          "change": 1,
          "platforms": {
            "chatgpt": { "position": 2, "type": "mention", "mentioned": true }
          },
          "competitorRankings": [
            { "competitorId": "comp_456", "avgPosition": 3.0, "name": "Competitor Inc", "domain": "competitor.com", "tracked": true }
          ]
        }
      ]
    }
  ]
}
```

<Note>May return `{"error": "Too much topic data. Try filtering by platform."}` for large datasets.</Note>

***

## platform\_get\_visibility\_sentiment

Get sentiment analysis from AI platform mentions — positive and negative themes with occurrence counts.

### Parameters

| Name       | Type   | Required | Default | Description                     |
| ---------- | ------ | -------- | ------- | ------------------------------- |
| `platform` | string | No       | `""`    | Filter: `chatgpt`, `perplexity` |

### Response

```json theme={null}
{
  "positive": [
    { "theme": "Easy to use", "occurrences": 12 },
    { "theme": "Good documentation", "occurrences": 8 }
  ],
  "negative": [
    { "theme": "Pricing concerns", "occurrences": 3 }
  ]
}
```

***

## platform\_get\_visibility\_status

Check the status of the latest AI visibility scan.

### Parameters

None.

### Response

```json theme={null}
{
  "status": "completed",
  "timestamp": "2026-03-20T10:30:00Z"
}
```

Status values: `running`, `completed`, `failed`.
