用户趋势

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

功能介绍

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

接口

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

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

获取表格数据

参数名参数类型是否必须描述
methodstringnewuser/a
metricsstring指标列表,指标间逗号分隔
granint数据粒度(按日:5,按时:6)

获取趋势数据

参数名参数类型是否必须描述
methodstringnewuser/f
metricsstring指标,只支持单个指标
granint数据粒度(按日:5,按时:6)

指标

指标名描述适用接口
new_user_count新用户newuser/a,newuser/f
upgrade_user_count升级用户newuser/a
brand_new_user_count版本新用户newuser/a,newuser/f
new_user_ratio新用户占比newuser/a,newuser/f
old_user_count老用户newuser/a,newuser/f
old_user_ratio老用户占比newuser/a,newuser/f
brand_old_user_count版本老用户newuser/a,newuser/f
brand_old_user_ratio版本老用户占比newuser/a,newuser/f
user_count启动用户newuser/a,newuser/f
user_count_hour分时用户,获取按时数据,gran=6 时可用newuser/a,newuser/f
session_count启动次数newuser/a,newuser/f
average_session_time平均使用时长newuser/a,newuser/f
session_time_per_person人均使用时长newuser/a,newuser/f

示例

获取用户趋势数据

请求

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

响应

{
    "status": 0,
    "msg": "",
    "data": {
        "offset": 0,
        "timeSpan": [
            "2017/10/10 - 2017/11/08"
        ],
        "fields": [
            "simple_date_title",
            "new_user_count",
            "user_count"
        ],
        "total": 2,
        "end": 0,
        "sum": [
            [
                591,
                0,
                591,
                48.56,
                1217,
                5167,
                113,
                483
            ],
            []
        ],
        "pageSum": [],
        "items": [
            [
                [
                    "2017/11/08"
                ],
                [
                    "2017/11/07"
                ]
            ],
            [
                [
                    120,
                    249
                ],
                [
                    175,
                    531
                ]
            ],
            [],
            []
        ]
    }
}