用户分群和标签API

调用方法请参见Open API文档中的调用方法描述。

0. 通用参数字段说明

字段 描述
projectId 102
clusterName 分群名称
displayName 分群显示名称
clusterCatalog 分群类别
clusterType 分群类型
qp 分群查询条件(类型为UserClusterDef)
tagQp 标签查询条件

分群类别(clusterCatalog)取值说明:

描述
catalog_cluster 分群
catalog_tag 标签

分群方式(clusterType)取值说明:

描述
cluster_by_dynamic_condition 动态条件更新用户群
cluster_by_static_condition 静态条件用户群
cluster_by_result 结果分群
tag_by_dynamic_condition 动态条件更新用户标签
tag_by_static_condition 静态条件用户标签:

UserClusterDef字段说明:

字段 描述
events 参与事件条件列表
event_relation 参与事件条件之间的逻辑关系
filts 用户属性条件列表
relation 用户属性条件之间的逻辑关系
event_user_relation 参与事件条件列表与用户属性条件列表之间的逻辑关系

1.添加条件分群,结果分群或用户标签

[POST /open/user-cluster-add?token=xxxxxxx]

  • 条件分群 Request body (application/json)
    {
    "projectId": 102,
    "clusterName": "recent_7_days_consume",
    "clusterCatalog": "catalog_cluster",
    "clusterType": "cluster_by_static_condition",
    "displayName": "recent_7_days_consume",
    "qp": {
      "events": [
        {
          "comparator": "greater",
          "endTime": "2020-01-09 00:00:00",
          "eventName": "consume_item",
          "num": "4",
          "recentDay": "1-7",
          "startTime": "2020-01-03 00:00:00",
          "taPropQuota": {
            "analysis": "TIMES"
          }
        }
      ],
      "event_relation": "and",
      "filts": [
        {
          "columnName": "user_level",
          "comparator": "equal",
          "ftv": [
            "3"
          ],
          "tableType": "user"
        }
      ],
      "relation": "and",
      "event_user_relation": "and"
    }
    }
    
  • 条件标签 Request body (application/json)
    {
    "projectId": 102,
    "clusterName": "tag_20200615_1",
    "clusterCatalog": "catalog_tag",
    "clusterType": "tag_by_static_condition",
    "displayName": "标签_20200615_1",
    "tagQp": {
      "userTagValueDefs": [
        {
          "tagRemark": "",
          "tagValue": "标签值1",
          "userClusterDef": {
            "event_relation": "and",
            "event_user_relation": "and",
            "events": [
              {
                "endTime": "2020-06-14 17:36:40",
                "eventName": "player_register",
                "num": "4",
                "recentDay": "1-30",
                "relation": "and",
                "startTime": "2020-05-16 17:36:40",
                "taPropQuota": {
                  "analysis": "TIMES"
                },
                "comparator": "greater"
              }
            ],
            "filts": [],
            "relation": "and"
          }
        },
        {
          "tagRemark": "",
          "tagValue": "标签值2",
          "userClusterDef": {
            "event_relation": "and",
            "event_user_relation": "and",
            "events": [
              {
                "endTime": "2020-06-14 17:36:55",
                "eventName": "fight_success",
                "num": "0",
                "recentDay": "1-30",
                "relation": "and",
                "startTime": "2020-05-16 17:36:55",
                "taPropQuota": {
                  "analysis": "TIMES"
                }
                "uceCalcuSymbol": "greater"
              }
            ],
            "filts": [],
            "relation": "and"
          }
        }
      ]
    }
    }
    

tagQp字段说明:

字段 描述
tagValue 标签值
userClusterDef 标签值匹配定义,字段定义见UserClusterDef
  • Response body (application/json)
    {
    "return_code": 0,
    "return_message": "success",
    "data": 970
    }
    
    结果字段说明:
字段 描述
data 分群id

2 分群或标签详情查询

[GET /open/user-cluster-detail?token=xxxxxxx&projectId=xxx&clusterId=xxxxxx]

  • Response body (application/json)
    {
    "data": {
      "clusterName": "recent_7_days_consume",
      "clusterType": "cluster_by_static_condition",
      "displayName": "recent_7_days_consume",
      "id": 970,
      "progress": 1,
      "projectId": 102,
      "refreshTime": "2020-01-10 10:51:14",
      "userClusterDef": {
        "event_relation": "and",
        "event_user_relation": "and",
        "events": [
          {
            "comparator": "greater",
            "endTime": "2020-01-09 00:00:00",
            "eventName": "consume_item",
            "num": "4",
            "recentDay": "1-7",
            "startTime": "2020-01-03 00:00:00",
            "taPropQuota": {
              "analysis": "TIMES"
            }
          }
        ],
        "filts": [
          {
            "columnName": "user_level",
            "comparator": "equal",
            "ftv": [
              "3"
            ],
            "tableType": "user"
          }
        ],
        "relation": "and"
      },
      "userId": 13,
      "usersNum": 0
    },
    "return_code": 0,
    "return_message": "success"
    }
    
    参数字段说明请参考通用参数字段说明

3 更新分群和标签

[POST /open/user-cluster-update?token=xxxxxxx&clusterId=xxx]

  • Request body (application/json)
{
  "clusterCatalog": "catalog_cluster",
  "clusterType": "cluster_by_static_condition",
  "displayName": "recent_7_days_consume",
  "projectId": 102,
  "qp": {
    "event_relation": "and",
    "event_user_relation": "and",
    "events": [
      {
        "comparator": "greater",
        "endTime": "2020-01-09 00:00:00",
        "eventName": "consume_item",
        "num": "4",
        "recentDay": "1-7",
        "startTime": "2020-01-03 00:00:00",
        "taPropQuota": {
          "analysis": "TIMES"
        }
      }
    ],
    "filts": [
      {
        "columnName": "user_level",
        "comparator": "equal",
        "ftv": [
          "3"
        ],
        "tableType": "user"
      }
    ],
    "relation": "and"
  }
}

参数字段说明请参考通用参数字段说明

  • Response body (application/json)
    {
    "return_code": 0,
    "return_message": "success"
    }
    

    4 删除分群或标签

    [POST /open/user-cluster-delete?token=xxxxxxx&projectId=xxx&clusterId=xxxxxx]

  • Response body (application/json)
    {
    "return_code": 0,
    "return_message": "success"
    }
    

    5 分群和标签列表查询

    [POST /open/user-cluster-list?token=xxxxxxx]

  • Request body (application/json)
    {
    "clusterCatalog": "catalog_cluster",
    "clusterTypes": [
      "cluster_by_dynamic_condition",
      "cluster_by_static_condition"
    ],
    "pagerHeader": {
      "pageNum": 1,
      "pageSize": 10
    },
    "projectId": 102
    }
    
  • Response body (application/json)
    {
    "data": {
      "pagerResult": {
        "pageNum": 1,
        "pageSize": 10,
        "totalNum": 2
      },
      "userClusters": [
        {
          "clusterName": "xuzz_ces",
          "clusterType": "cluster_by_static_condition",
          "displayName": "用户数",
          "id": 905,
          "progress": 100,
          "refreshTime": "2019-11-01 15:08:31",
          "remarks": "2134",
          "userId": 108,
          "userName": "xuzz",
          "usersNum": 4665
        },
        {
          "clusterName": "test",
          "clusterType": "cluster_by_static_condition",
          "displayName": "test",
          "id": 183,
          "progress": 100,
          "refreshTime": "2019-11-01 15:05:28",
          "remarks": "test",
          "userId": 108,
          "userName": "xuzz",
          "usersNum": 5603
        }
      ]
    },
    "return_code": 0,
    "return_message": "success"
    }
    

6 刷新条件分群或标签并获取进度

[POST /open/user-cluster-refresh?token=xxxxxxx&projectId=xxx&clusterId=xxxxxx]

  • Response body (application/json)
    {
    "return_code": 0,
    "return_message": "success"
    }
    
    提交刷新后,可查询刷新进度

[GET /open/user-cluster-refresh-progress?token=xxxxxxx&projectId=xxx&clusterId=xxxxxx]

  • Response body (application/json)
    {
    "data": {
      "progress": 80,
    },
    "return_code": 0,
    "return_message": "success"
    }
    

结果字段说明:

字段 描述
progress 取值范围[0, 100], 100代表刷新完成

results matching ""

    No results matching ""