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

# 組件分析

> 小組件的會話、線索、消息、轉化率及地理分佈的聚合統計數據。

返回所選時間窗口的關鍵指標（KPI）、用於對比的上一週期數據、按日的時間序列，以及排名靠前的推薦來源/國家/地區。

## 身份驗證

需要提供 Bearer 令牌（API 密鑰）或儀表盤會話。

## 路徑參數

<ParamField path="id" type="string" required>
  小組件配置的 UUID。
</ParamField>

## 查詢參數

<ParamField query="window" type="string" default="30d">
  報告時間窗口：`7d`、`30d` 或 `90d`。
</ParamField>

## 響應

<ResponseField name="window" type="string">
  實際生效的時間窗口。
</ResponseField>

<ResponseField name="kpi" type="object">
  `total_sessions`、`total_leads`、`total_messages`、`conversion_rate`、`avg_session_duration_seconds`、`avg_messages_per_session`、`identified_sessions`、`anonymous_sessions`。
</ResponseField>

<ResponseField name="previous_period_kpi" type="object">
  上一週期的相同 KPI 數據結構。
</ResponseField>

<ResponseField name="series" type="object">
  按日的時間序列：`sessions`、`leads`、`messages`，每項均為 `{ day, count }` 組成的數組。
</ResponseField>

<ResponseField name="top_referrers" type="array">
  最多 10 條 `{ url, count }` 記錄。
</ResponseField>

<ResponseField name="top_countries" type="array">
  最多 10 條 `{ country, count }` 記錄。
</ResponseField>

<ResponseField name="top_country_coords" type="array">
  可直接用於地圖渲染的 `{ country, name, lat, lng, count }` 記錄，對應排名靠前的國家/地區。
</ResponseField>

## 示例

```bash curl theme={null}
curl "https://www.hitheo.ai/api/v1/iframes/CONFIG_ID/analytics?window=7d" \
  -H "Authorization: Bearer $THEO_API_KEY"
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.