页面分析

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

功能介绍

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

接口

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

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

获取表格数据

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

获取趋势数据

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

指标

指标名描述适用接口
pv_count访问次数visit/page/a,visit/page/f
pv_ratio访问次数占比visit/page/a
average_stay_time平均停留时间visit/page/a,visit/page/f
stay_time_ratio停留时间占比visit/page/a
bounce_ratio页面跳出率visit/page/a,visit/page/f

示例

获取页面分析数据

请求

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

响应

{
    "status": 0,
    "msg": "",
    "data": {
        "offset": 0,
        "timeSpan": [
            "2017/11/07 - 2017/11/08"
        ],
        "fields": [
            "visit_page_title",
            "visit_page_alias_title",
            "pv_count",
            "pv_ratio",
        ],
        "total": 2,
        "sum": [
            [
                17862,
                100,
            ],
            []
        ],
        "pageSum": [],
        "items": [
            [
                [
                    {
                        "pageName": "searchindex",
                        "pageId": "1307*******698719220",
                        "pageAlias": "搜索页"
                    }
                ],
                [
                    {
                        "pageName": "logsHomePagePv",
                        "pageId": "38326******3786092",
                        "pageAlias": "2.0首页精彩推荐tab"
                    }
                ],
            ],
            [
                [
                    5734,
                    32.1,
                ],
                [
                    4750,
                    26.59,
                ]
            ],
            [],
            []
        ]
    }
}