腾讯有数官方文档

核销优惠券 consume_coupon

定义

在市场营销中,用户通过优惠券换取购买折扣是一种常见的行为,通过收集「核销优惠券行为」能够有效的判断用户的喜好

数据规范

优惠券维度

名称 类型 描述
action_type 必填 enum

细分行为类型

  • pre_consume 预核销行为,在订单行为give_order(下单)时发生

  • consume 已核销行为,在订单行为pay(支付)时发生

  • refund_consume 退还核销行为,在订单行为refund(退款)时发生

coupon 必填 object

优惠券批次

coupon_id 必填 string

优惠券批次在商家自有系统里的『唯一标识符』

external 必填 boolean

总是传true,表示数据来自外部数据源,参考 优惠券批次
系统通过coupon_id来关联该外部数据源

true
coupon_instance 必填 object

优惠券发放实例

coupon_ins_id 必填 string

优惠券实例的唯一标识符

coupon_ins_name 必填 string

优惠券实例的名称

券订单维度

名称 类型 描述
order_id string

关联属性 优惠券关联的主订单ID,order_id和sub_order选填其一

sub_order_id string

关联属性 优惠券关联的子订单ID,order_id和sub_order选填其一

coupon_deduction float

当前优惠券抵扣的优惠金额(元),对子订单来说是分摊到子订单的优惠金额

page 必填 string

行为发生的小程序页面路径,开头不要加 /,路径后可带查询参数

pages/product?sku_id=AOdjf7u
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": "consume_coupon",
    "props": {
        "action_type": "pre_consume",
        "coupon": {
            "coupon_id": "",
            "external": true
        },
        "coupon_instance": {
            "coupon_ins_id": "",
            "coupon_ins_name": ""
        },
        "order_id": "",
        "sub_order_id": "",
        "coupon_deduction": "",
        "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&timestamp=TIMESTAMP&nonce=NONCE",
    method: "post",
    data: body,
    success(res) {
        console.log(res)
    }
})