地域分布

优质
小牛编辑
132浏览
2023-12-01

功能介绍

获取地域分布报告数据,包括表格详情数据与趋势数据,所获取数据与 https://mtj.baidu.com 中报告数据一致

接口

https://openapi.baidu.com/rest/2.0/mtj/svc/app/getDataByKey

此处仅列本接口特有参数,公共参数请参考报告级API说明

获取表格数据

参数名参数类型是否必须描述
methodstringregion/a
metricsstring指标列表,指标间逗号分隔

获取趋势数据

参数名参数类型是否必须描述
methodstringregion/f
metricsstring指标,只支持单个指标

指标

指标名描述适用接口
session_count_district启动次数region/a,region/f
session_count_district_ratio启动次数占比region/a
new_user_count_district_ratio新用户分布region/a
user_count_district_ratio启动用户分布region/a
average_session_time_district平均使用时长region/a

示例

获取地域分布数据

请求

https://openapi.baidu.com/rest/2.0/mtj/svc/app/getDataByKey?access_token=[ACCESS_TOKEN]&key=[APPKEY]&method=region/a&start-date=20171107000000&end-date=20171108232359&metrics=session_count_district,session_count_district_ratio

响应

{
    "status": 0,
    "msg": "",
    "data": {
        "offset": 0,
        "timeSpan": [
            "2017/11/07 - 2017/11/08"
        ],
        "fields": [
            "district_title",
            "session_count_district",
            "session_count_district_ratio",
        ],
        "total": 2,
        "sum": [
            [
                232,
                100
            ],
            []
        ],
        "pageSum": [],
        "items": [
            [
                [
                    {
                        "id": "5",
                        "name": "福建"
                    }
                ],
                [
                    {
                        "id": "21",
                        "name": "辽宁"
                    }
                ]
            ],
            [
                [
                    37,
                    15.95,
                ],
                [
                    27,
                    11.64,
                ]
            ],
            [],
            []
        ]
    }
}