商品加购 add_to_cart
定义
用户添加商品到购物车的行为


数据规范
动作维度
名称 | 类型 | 描述 |
---|---|---|
action_type 必填 | enum |
动作类型
|
商品维度
名称 | 类型 | 描述 |
---|---|---|
sku 必填 | object |
商品 |
sku_id 必填 | string |
商品唯一标识符 例AKDFie8-1 |
sku_name 必填 | string |
商品名称 例妃子笑荔枝礼盒装(2KG) |
spu 必填 | object |
是商品信息聚合的一个单元 |
spu_id 必填 | string |
标准化产品单元的唯一标识符 例AKDFie8 |
spu_name 必填 | string |
标准化产品单元的名称 例妃子笑荔枝 |
sku_category | object[] |
商品类目路径 |
sku_cat_id 必填 | string |
商品类目ID,唯一标识符 |
sku_cat_name 必填 | string |
商品类目名称 |
sku_parent_cat_id 必填 | string |
商品父级类目ID,若已经是顶级类目,则填 |
shipping_shop | object |
商品发货门店 |
shipping_shop_id 必填 | string |
商品发货门店id;当商品所属门店同于行为发生门店时,shop_id 与 chan_shop_id 值一致 例AKDFie8 |
shipping_shop_name 必填 | string |
商品发货门店名称 例妃子笑深圳店 |
sale | object |
销售信息 |
original_price 必填 | float |
商品当前原价单价(元),一般是划线价 例49.9 |
current_price 必填 | float |
商品当前现价(元) 例30.0 |
sku_num 必填 | integer |
本次动作生效之后购物车里的商品件数 例3 |
公共基础属性
名称 | 类型 | 描述 |
---|---|---|
page 必填 | string |
行为发生的小程序页面路径,开头不要加 |
page_title | string |
行为发生的小程序页面标题 例商品详情、商城首页 |
sr_sdk_version | string |
sdk版本号 例1.1.6 |
time 必填 | datetime |
行为发生时间 例1560409473714 |
wx_user 必填 | object |
用户相关属性 |
app_id 必填 | string |
公众号或小程序唯一标识 例wx9d4f5f22pa099f82 |
open_id 必填 | string |
微信用户在小程序下的唯一标识符 例ogN6X0T-ilsH-XmIdzXtuR1f1r3Q |
user_id | string |
用户在商户的唯一标识符 例548019854034 |
union_id | string |
微信用户在开放平台账号下的唯一标识符 例o6_bmlsdaXds8d6_sgVt7hM3OPfL |
local_id | string |
用户在有数的唯一标识符 例360b8853-64bf-3fba-e9a0-5abb1e4d7721 |
tag | object[] |
用户的个性化标签 |
tag_id 必填 | string |
标签ID,唯一标识符 例游客 |
tag_name 必填 | string |
标签名称 例游客 |
extra | object | |
chan 必填 | object |
渠道相关属性 |
chan_wxapp_scene 必填 | int |
小程序场景值,必填 例1037 |
chan_id | string |
引流渠道的标识符 |
chan_refer_app_id | string |
来源小程序或公众号appid 例wx9d6f5f6gea059654 |
chan_shop_id | string |
门店ID,若需要计算门店业务则必填 |
chan_shop_name | string |
门店名称,展示字段,若chan_shop_id存在则必填 |
chan_custom | object |
自定义渠道 |
chan_custom_id 必填 | string |
4级自定义渠道的标识符,4级是自定义渠道的最小粒度 例mp-article-12375 |
chan_custom_id_desc 必填 | string |
4级自定义渠道的描述 例公众号文章(id=12375) |
chan_custom_cat_3 必填 | string |
3级自定义渠道的标识符,3级是针对4级的分类,要求4级数据必须存在 例mp-article |
chan_custom_cat_3_desc 必填 | string |
3级自定义渠道的描述,若chan_custom_cat_3存在则必须存在 例公众号文章 |
chan_custom_cat_2 必填 | string |
2级自定义渠道的标识符,2级是针对3级的分类,要求34级数据必须存在 例media |
chan_custom_cat_2_desc 必填 | string |
2级自定义渠道的描述,若chan_custom_cat_2存在则必须存在 例媒体 |
chan_custom_cat_1 必填 | string |
1级自定义渠道的标识符,1级是针对2级的分类,要求234级数据必须存在 例wechat |
chan_custom_cat_1_desc 必填 | string |
1级自定义渠道的描述,若chan_custom_cat_1存在则必须存在 例微信 |
extra | object | |
component | object |
组件是视图上的一个区块元素 |
component_id | string |
组件ID |
component_name | string |
组件名称 |
请求示例
let body = {
"type": "add_to_cart",
"props": {
"action_type": "first_add_to_cart",
"sku": {
"sku_id": "AKDFie8-1",
"sku_name": "妃子笑荔枝礼盒装(2KG)"
},
"spu": {
"spu_id": "AKDFie8",
"spu_name": "妃子笑荔枝"
},
"sku_category": [
{
"sku_cat_id": "11",
"sku_cat_name": "11",
"sku_parent_cat_id": "11"
}
],
"sale": {
"original_price": 49.9,
"current_price": 30
},
"sku_num": 3,
"page": "pages/product?sku_id=AOdjf7u",
"page_title": "商品详情、商城首页",
"time": "1560409473714",
"wx_user": {
"app_id": "wx9d4f5f22pa099f82",
"open_id": "ogN6X0T-ilsH-XmIdzXtuR1f1r3Q",
"user_id": "548019854034",
"union_id": "o6_bmlsdaXds8d6_sgVt7hM3OPfL",
"local_id": "360b8853-64bf-3fba-e9a0-5abb1e4d7721",
"tag": [
{
"tag_id": "游客",
"tag_name": "游客"
}
]
},
"chan": {
"chan_wxapp_scene": 1037,
"chan_id": "",
"chan_refer_app_id": "wx9d6f5f6gea059654",
"chan_shop_id": "",
"chan_shop_name": "",
"chan_custom": {
"chan_custom_id": "mp-article-12375",
"chan_custom_id_desc": "公众号文章(id=12375)",
"chan_custom_cat_3": "mp-article",
"chan_custom_cat_3_desc": "公众号文章",
"chan_custom_cat_2": "media",
"chan_custom_cat_2_desc": "媒体",
"chan_custom_cat_1": "wechat",
"chan_custom_cat_1_desc": "微信"
}
},
"component": {
"component_id": "",
"component_name": ""
}
}
}
wx.request({
url: "https://zhls.qq.com/api/report?app_id=APPID×tamp=TIMESTAMP&nonce=NONCE",
method: "post",
data: body,
success(res) {
console.log(res)
}
})