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

# Link Statistics

> Retrieve detailed statistics for a specific link

**Request:**

```bash cURL theme={null}
curl -X GET 'https://api.taap.it/v1/stats/links/link_987654321?start_date=2024-01-01T00:00:00Z&end_date=2024-01-31T23:59:59Z&max_days=30' \
  -H 'Authorization: Bearer taapit_your_api_key_here'
```

**Response:**

```json theme={null}
[
  {
    "id": "stat_123456789",
    "link_id": "link_987654321",
    "last_updated": "2024-01-15T10:30:00Z",
    "click_date": "2024-01-15",
    "total_clicks": 45,
    "unique_visitors": 38,
    "scans_only": 5,
    "clicks_only": 40,
    "chrome_clicks": 25,
    "ios_clicks": 15,
    "android_clicks": 5,
    "os_stats": {
      "iOS": 15,
      "Android": 5,
      "Windows": 20,
      "macOS": 5
    },
    "city_stats": {
      "New York": 10,
      "Los Angeles": 8,
      "Toronto": 5
    },
    "os_version_stats": {
      "iOS 17.0": 10,
      "iOS 16.5": 5,
      "Android 13": 3,
      "Android 12": 2
    },
    "lang_stats": {
      "en": 30,
      "fr": 8,
      "es": 7
    },
    "device_stats": {
      "mobile": 28,
      "desktop": 15,
      "tablet": 2
    },
    "browser_stats": {
      "Chrome": 32,
      "Safari": 8,
      "Firefox": 3,
      "Edge": 2
    },
    "country_stats": {
      "US": 25,
      "CA": 12,
      "UK": 8
    },
    "device_and_os_stats": {
      "iPhone iOS": 15,
      "Android Phone": 5,
      "Windows Desktop": 20,
      "Mac Desktop": 5
    },
    "app_stats": {
      "Safari": 8,
      "Chrome Mobile": 15,
      "Chrome Desktop": 17
    },
    "device_type_stats": {
      "smartphone": 20,
      "desktop": 20,
      "tablet": 5
    },
    "from_app_stats": {
      "true": 8,
      "false": 37
    },
    "continent_stats": {
      "North America": 37,
      "Europe": 8
    }
  }
]
```

## Authorization

<ParamField header="Authorization" type="string" required>
  Bearer token for API authentication. Format: `Bearer YOUR_API_KEY`
</ParamField>

## Path Parameters

<ParamField path="link_id" type="string" required>
  Unique identifier for the link
</ParamField>

## Query Parameters

<ParamField query="start_date" type="string">
  Start date for statistics (ISO 8601 format, e.g., 2024-01-01T00:00:00Z)
</ParamField>

<ParamField query="end_date" type="string">
  End date for statistics (ISO 8601 format, e.g., 2024-01-31T23:59:59Z)
</ParamField>

<ParamField query="max_days" type="integer">
  Maximum number of days to retrieve statistics for (minimum: 1, maximum: 30)
</ParamField>

## Response Fields

<ResponseField name="id" type="string" required>
  Unique identifier for the statistics record
</ResponseField>

<ResponseField name="link_id" type="string" required>
  Unique identifier for the link
</ResponseField>

<ResponseField name="last_updated" type="string" required>
  ISO 8601 timestamp when the statistics were last updated
</ResponseField>

<ResponseField name="click_date" type="string" required>
  Date for the statistics (YYYY-MM-DD format)
</ResponseField>

<ResponseField name="total_clicks" type="integer" required>
  Total number of clicks on this date
</ResponseField>

<ResponseField name="unique_visitors" type="integer" required>
  Number of unique visitors on this date
</ResponseField>

<ResponseField name="scans_only" type="integer" required>
  Number of QR code scans without clicks on this date
</ResponseField>

<ResponseField name="clicks_only" type="integer" required>
  Number of direct clicks without scans on this date
</ResponseField>

<ResponseField name="chrome_clicks" type="integer" required>
  Number of clicks from Chrome browser on this date
</ResponseField>

<ResponseField name="ios_clicks" type="integer" required>
  Number of clicks from iOS devices on this date
</ResponseField>

<ResponseField name="android_clicks" type="integer" required>
  Number of clicks from Android devices on this date
</ResponseField>

<ResponseField name="os_stats" type="object">
  Statistics broken down by operating system

  <Expandable title="Operating system statistics">
    <ResponseField name="{os_name}" type="integer" required>
      Number of clicks from this operating system (OS name as key)
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="city_stats" type="object">
  Statistics broken down by city

  <Expandable title="City statistics">
    <ResponseField name="{city_name}" type="integer" required>
      Number of clicks from this city (city name as key)
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="os_version_stats" type="object">
  Statistics broken down by operating system version

  <Expandable title="OS version statistics">
    <ResponseField name="{version}" type="integer" required>
      Number of clicks from this OS version (version as key)
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="lang_stats" type="object">
  Statistics broken down by language

  <Expandable title="Language statistics">
    <ResponseField name="{language_code}" type="integer" required>
      Number of clicks from this language (language code as key)
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="device_stats" type="object">
  Statistics broken down by device type

  <Expandable title="Device statistics">
    <ResponseField name="mobile" type="integer" required>
      Number of clicks from mobile devices
    </ResponseField>

    <ResponseField name="desktop" type="integer" required>
      Number of clicks from desktop devices
    </ResponseField>

    <ResponseField name="tablet" type="integer" required>
      Number of clicks from tablet devices
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="browser_stats" type="object">
  Statistics broken down by browser

  <Expandable title="Browser statistics">
    <ResponseField name="{browser_name}" type="integer" required>
      Number of clicks from this browser (browser name as key)
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="country_stats" type="object">
  Statistics broken down by country

  <Expandable title="Country statistics">
    <ResponseField name="{country_code}" type="integer" required>
      Number of clicks from this country (country code as key)
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="device_and_os_stats" type="object">
  Statistics broken down by device and operating system combination

  <Expandable title="Device and OS statistics">
    <ResponseField name="{device_os}" type="integer" required>
      Number of clicks from this device-OS combination (device-OS as key)
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="app_stats" type="object">
  Statistics broken down by application

  <Expandable title="Application statistics">
    <ResponseField name="{app_name}" type="integer" required>
      Number of clicks from this application (app name as key)
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="device_type_stats" type="object">
  Statistics broken down by device type (detailed)

  <Expandable title="Device type statistics">
    <ResponseField name="{device_type}" type="integer" required>
      Number of clicks from this device type (device type as key)
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="from_app_stats" type="object">
  Statistics showing clicks from apps vs web browsers

  <Expandable title="App vs web statistics">
    <ResponseField name="true" type="integer" required>
      Number of clicks from mobile applications
    </ResponseField>

    <ResponseField name="false" type="integer" required>
      Number of clicks from web browsers
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="continent_stats" type="object">
  Statistics broken down by continent

  <Expandable title="Continent statistics">
    <ResponseField name="{continent_name}" type="integer" required>
      Number of clicks from this continent (continent name as key)
    </ResponseField>
  </Expandable>
</ResponseField>
