> ## 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.