流量分组 x 自定义维度
简介
聚合SDK提供多个维度对用户进行分组,不同的流量分组可以配置不同的Waterfall,以实现精细化流量变现。目前支持流量分组维度如下:user_id,渠道,子渠道,年龄,性别,用户变现分组,且提供自定义维度配置。该功能依赖平台功能。
支持自定义分组类型
预定义分组 | 说明 |
---|---|
user_id | 用户ID。由开发者定义并传入聚合SDK,后续M支持基于用户ID维度统计数据 |
channel | 渠道。建议使用以下字符规则:大小写字母数字和下划线[A-Za-z0-9_] |
sub_channel | 子渠道。建议使用以下字符规则:大小写字母数字和下划线[A-Za-z0-9_] |
age | 年龄 |
gender | 性别, 如male、female、unknow |
user_value_group | 用户变现价值分组,如1,2,3 |
自定义分组 | 说明 |
---|---|
custom_key | custom_value |
添加自定义配置需遵循条件:
1.key & value均为字符串,
2.key & value长度均不超过100;
3.key & value所允许字符为:字母、数字、下划线“_”、中线“-”
另,若不满足自定义配置条件,控制台log提醒,且不满足条件的字段,无法上报平台
接口说明
#import <Foundation/Foundation.h>
typedef NS_ENUM (NSInteger, CloooudUserInfo_Gender) {
CloooudUserInfo_Gender_Female = 0,
CloooudUserInfo_Gender_Male = 1,
CloooudUserInfo_Gender_Unknown = 2,
CloooudUserInfo_Gender_UnSet = 3
//default,can't use.
};
@interface CloooudUserInfoForSegment : NSObject
/// user_id
@property (nonatomic, copy) NSString *user_id;
/// 渠道
@property (nonatomic, copy) NSString *channel;
@property (nonatomic, copy) NSString *sub_channel;
/// user age,type:int
@property (nonatomic, assign) NSInteger age;
/// user gender,please use CloooudUserInfo_Gender to set
@property (nonatomic, assign) CloooudUserInfo_Gender gender;
/// 价值分组
@property (nonatomic, copy) NSString *user_value_group;
/// custom setting
/**
要求:
自定义参数key&value要求均为string
字符为数字,字母,"-","_"任意组合
长度上限为100
*/
@property (nonatomic, copy) NSDictionary *customized_id;
@end
用户自定义分组设定方式
CloooudAdSDKManager.h中增加设定方法,调用方式如下
/**
* User info for segment
* @param userInfo
* Can't be null
* Please enter the values according to the format and rule
* ps: ①value changed -> reload config,be care for.
* ②if setUserInfoForSegment after MSDK init,first get config has no segment info.
*/
+ (void)setUserInfoForSegment:(nonnull CloooudUserInfoForSegment *)userInfo;
使用示例
// create segment instance
CloooudUserInfoForSegment *segment = [[CloooudUserInfoForSegment alloc] init];
// set info
segment.user_id = @"Please enter your user's Id";
segment.user_value_group = @"group1";
segment.age = 19;
segment.gender = CloooudUserInfo_Gender_Male;
segment.channel = @"Apple";
segment.sub_channel = @"Apple store";
segment.customized_id = @{@"key1":@"345",
@"key2":@"good",
@"key3":@"123aA-_",
};
// info send to CloooudAdSDKManager
[CloooudAdSDKManager setUserInfoForSegment:segment];
// setAppID,init SDK
[CloooudAdSDKManager setupSDKWithAppId:@"5000546" config:^CloooudUserConfig *(CloooudUserConfig *c) {
c.logEnable = YES;
c.extraDeviceMap = didDic;
c.advanceSDKConfigPath = [[NSBundle mainBundle] pathForResource:@"config-ios-5000546" ofType:@"json"];
return c;
}];
}