腾讯有数官方文档

创建微信小程序VisitDistribution数据源

请求接口:

/data-api/v1/analysis/create_wxapp_visit_distribution_data_source

请求方法:

POST

请求参数:

参数名 样例 描述
app_id abc 分配的app_id
nonce 61794670f155b 随机字符串
sign sha256 签名算法
timestamp 1569232087 请求时间戳(秒级)
signature aee30792812d7b09ba7d3aa67c24e16c6a7ea81282ac728ad5966dd1b3eef6d5 签名结果

请求体类型:

application/json

请求体参数:

参数名 类型 描述
merchantId string 商家id

响应体结构:

参数名 二级字段 类型 描述
retcode integer 返回码
errmsg string 错误信息
data json object 响应内容
dataSource DataSource 数据源

请求示例:

curl 'https://域名/data-api/v1/analysis/create_wxapp_visit_distribution_data_source?app_id=abc&nonce=61794670f155b&sign=sha256&timestamp=1569232087&signature=aee30792812d7b09ba7d3aa67c24e16c6a7ea81282ac728ad5966dd1b3eef6d5' \
-X POST \
-H 'Content-Type: application/json' \
-d '{
  "merchantId":"123"
}'

响应示例:

{
  "retcode":0,
  "errmsg":"",
  "data" {
    "dataSource": {
      "id": "108",
      "type": 8,
      "merchantId": "123"
    }
  }
}

上报微信小程序VisitDistribution数据

请求接口:

/data-api/v1/analysis/add_wxapp_visit_distribution

请求方法:

POST

请求参数:

参数名 样例 描述
app_id abc 分配的app_id
nonce 61794670f155b 随机字符串
sign sha256 签名算法
timestamp 1569232087 请求时间戳(秒级)
signature aee30792812d7b09ba7d3aa67c24e16c6a7ea81282ac728ad5966dd1b3eef6d5 签名结果

请求体类型:

application/json

请求体参数:

参数名 类型 描述
dataSourceId string 数据源id(create方法返回的data.dataSource.id)
rawMsg json array 微信小程序后台请求结果列表

响应体结构:

参数名 类型 描述
retcode integer 返回码
errmsg string 错误信息
data json object 响应内容

请求示例:

curl 'https://域名/data-api/v1/analysis/add_wxapp_visit_distribution?app_id=abc&nonce=61794670f155b&sign=sha256&timestamp=1569232087&signature=aee30792812d7b09ba7d3aa67c24e16c6a7ea81282ac728ad5966dd1b3eef6d5' \
-X POST \
-H 'Content-Type: application/json' \
-d ' {
  "dataSourceId":"108",
  "rawMsg": [
    {
      "ref_date": "20170313",
      "list": [
        {
          "index": "access_source_session_cnt",
          "item_list": [
            {
              "key": 10,
              "value": 5
            },
            {
              "key": 8,
              "value": 687
            },
            {
              "key": 7,
              "value": 10740
            },
            {
              "key": 6,
              "value": 1961
            },
            {
              "key": 5,
              "value": 677
            },
            {
              "key": 4,
              "value": 653
            },
            {
              "key": 3,
              "value": 1120
            },
            {
              "key": 2,
              "value": 10243
            },
            {
              "key": 1,
              "value": 116578
            }
          ]
        },
        {
          "index": "access_staytime_info",
          "item_list": [
            {
              "key": 8,
              "value": 16329
            },
            {
              "key": 7,
              "value": 19322
            },
            {
              "key": 6,
              "value": 21832
            },
            {
              "key": 5,
              "value": 19539
            },
            {
              "key": 4,
              "value": 29670
            },
            {
              "key": 3,
              "value": 19667
            },
            {
              "key": 2,
              "value": 11794
            },
            {
              "key": 1,
              "value": 4511
            }
          ]
        },
        {
          "index": "access_depth_info",
          "item_list": [
            {
              "key": 5,
              "value": 217
            },
            {
              "key": 4,
              "value": 3259
            },
            {
              "key": 3,
              "value": 32445
            },
            {
              "key": 2,
              "value": 63542
            },
            {
              "key": 1,
              "value": 43201
            }
          ]
        }
      ]
    }
  ]
}'

响应示例:

{
  "retcode":0,
  "errmsg":"",
  "data": {}
}