> For a complete page index of the Captain API documentation, fetch https://docs.captain.dev/llms.txt?excludeSpec=true

# Get Clicks

GET https://acme.captain.dev/v1/indexes/{index}/analytics/clicks

Get the click-through rate in total and per day, the average click position, and clicks per position.

Reference: https://docs.captain.dev/reference/product-search/analytics/get-clicks

## Authentication

- `Authorization` header (bearer token, required) — A search key, issued by Captain. Sent as Authorization: Bearer \<key>.

## Request

### Path parameters

- `index` (string, required) — index name

### Query parameters

- `start_date` (string, optional) — first day, UTC, inclusive (YYYY-MM-DD). Default: 6 days before end_date (a 7-day window)
- `end_date` (string, optional) — last day, UTC, inclusive (YYYY-MM-DD). Default: today. At most 366 days from start_date
- `start_time` (string, optional) — an exact start instead of start_date: unix seconds, or ISO 8601 in UTC (2026-10-10T10:00:00Z). start_date and end_date in the reply are then the UTC days the window touches
- `end_time` (string, optional) — an exact end (exclusive): unix seconds or ISO 8601 with Z. Default: now; never later than now. Must be after start_time

## Response

### 200

report

- `start_date` (string, required)
- `end_date` (string, required)
- `rate` (double, required, nullable) — click-through rate: click_count / tracked_search_count
- `click_count` (integer, required) — tracked searches with at least one click
- `tracked_search_count` (integer, required)
- `average_position` (double, required, nullable) — mean position (1-based) of the clicks on tracked searches, two decimals; null with no clicks
- `positions` (list of V1IndexesIndexAnalyticsClicksGetResponsesContentApplicationJsonSchemaPositionsItems, required) — 12 buckets: positions 1 through 10 each, then 11-20, then 21 and beyond
- `dates` (list of V1IndexesIndexAnalyticsClicksGetResponsesContentApplicationJsonSchemaDatesItems, required) — every day of the window, oldest first; rate is null on a day with nothing to divide by
- `partial` (boolean, optional) — true when the search log was too large to read whole within one request's budget: the numbers cover what was counted
- `partial_reason` (enum, optional) — row_budget: more searches than one request holds (500,000); time_budget: more than about 3.5 seconds of reading; counting (usage): days still being counted
  - Allowed values: `row_budget`, `time_budget`, `counting`
- `counted_through` (double, optional, nullable) — the time (unix seconds) of the last record counted, when partial

## Types

### V1IndexesIndexAnalyticsClicksGetResponsesContentApplicationJsonSchemaPositionsItems

- `position` (list of integer, required) — [from, to]; to is -1 for the open-ended last bucket
- `click_count` (integer, required) — clicked results at these positions

### V1IndexesIndexAnalyticsClicksGetResponsesContentApplicationJsonSchemaDatesItems

- `date` (string, required)
- `rate` (double, required, nullable)

## Examples

**Response**

```json
{
  "start_date": "2026-09-22",
  "end_date": "2026-09-28",
  "rate": 0.3842,
  "click_count": 3656,
  "tracked_search_count": 9517,
  "average_position": 2.34,
  "positions": [
    {
      "position": [
        1,
        1
      ],
      "click_count": 2100
    },
    {
      "position": [
        2,
        2
      ],
      "click_count": 700
    },
    {
      "position": [
        3,
        3
      ],
      "click_count": 400
    },
    {
      "position": [
        4,
        4
      ],
      "click_count": 250
    },
    {
      "position": [
        5,
        5
      ],
      "click_count": 160
    },
    {
      "position": [
        6,
        6
      ],
      "click_count": 100
    },
    {
      "position": [
        7,
        7
      ],
      "click_count": 70
    },
    {
      "position": [
        8,
        8
      ],
      "click_count": 50
    },
    {
      "position": [
        9,
        9
      ],
      "click_count": 30
    },
    {
      "position": [
        10,
        10
      ],
      "click_count": 20
    },
    {
      "position": [
        11,
        20
      ],
      "click_count": 30
    },
    {
      "position": [
        21,
        -1
      ],
      "click_count": 10
    }
  ],
  "dates": [
    {
      "date": "2026-09-22",
      "rate": 0.3799
    },
    {
      "date": "2026-09-23",
      "rate": 0.3878
    },
    {
      "date": "2026-09-24",
      "rate": 0.3813
    },
    {
      "date": "2026-09-25",
      "rate": 0.391
    },
    {
      "date": "2026-09-26",
      "rate": 0.3825
    },
    {
      "date": "2026-09-27",
      "rate": 0.386
    },
    {
      "date": "2026-09-28",
      "rate": 0.3811
    }
  ]
}
```

**SDK Code**

```python Python REST
import json
import requests

BASE_URL = "https://acme.captain.dev"
API_KEY = "your_search_key"
INDEX = "products"

headers = {
    "Authorization": f"Bearer {API_KEY}",
}

response = requests.get(
    f"{BASE_URL}/v1/indexes/{INDEX}/analytics/clicks",
    headers=headers,
    params={"start_date": "2026-09-22", "end_date": "2026-09-28"},
    timeout=30.0,
)

print(json.dumps(response.json(), indent=2))
```

```typescript TypeScript REST
const BASE_URL = "https://acme.captain.dev";
const API_KEY = "your_search_key";
const index = "products";

const params = new URLSearchParams({ start_date: "2026-09-22", end_date: "2026-09-28" });

const response = await fetch(`${BASE_URL}/v1/indexes/${index}/analytics/clicks?${params}`, {
  method: "GET",
  headers: {
    Authorization: `Bearer ${API_KEY}`,
  },
});

const result = await response.json();
console.log(JSON.stringify(result, null, 2));
```