Menu

Custom Traffic Grouping

Tips:

  1. It is recommended to call the corresponding method before Taku SDK initialization to pass custom rule parameters.
  2. For more information about traffic groups, please refer to Traffic Groups
  1. App-Level Global Custom Rule Settings

Note: This custom rule is a global setting and applies to all Ad Placements.

Platform Method
Android initCustomMap
iOS customData
Unity initCustomMap

Predefined Keys for Custom Rules

Taku SDK predefines the following keys for App-level global custom rules:

Key Description
user_id User ID. Defined and passed by the developer to TopOn SDK. Subsequently, TopOn supports statistics based on the User ID dimension.
channel Channel. It is recommended to use the following character rules: uppercase and lowercase letters, digits, and underscores A-Za-z0-9\_
sub_channel Sub-Channel. It is recommended to use the following character rules: uppercase and lowercase letters, digits, and underscores A-Za-z0-9\_
user_number User Number. Developers can assign numbers to users, such as each user corresponding to a globally non-unique number. Only supported by Android SDK v6.1.32 and above.
age Age
gender Gender, e.g., male, female, unknow
iap_amount In-App Purchase Amount
iap_currency In-App Purchase Currency, e.g., "USD"
iap_time In-App Purchase Count

Note: If the above predefined keys cannot meet your needs, you may add custom keys. Note, however, that the key must match when adding custom traffic groups.

  1. Placement-Level Custom Rule Settings

Note: This custom rule only applies to the current Placement. You can add Placement-specific custom rules on top of the App-level custom rules.

Platform Method
Android initPlacementCustomMap
iOS setCustomData:forPlacementID
Unity setCustomDataForPlacementID
  1. Sample Code

Note: The following code sample represents a user with age=18, male, acquired through the ByteDance promotion channel.

Android

Copy
Map customMap = new HashMap<>();
customMap.put("age","18"); 
customMap.put("gender","male"); 
customMap.put("channel","bytedance"); 
ATSDK.initCustomMap(customMap); // Effective for all Placements
ATSDK.initPlacementCustomMap(placementId, customMap); // Effective only for the current Placement

iOS

Copy
// Effective for all Placements
[ATAPI sharedInstance].customData = @{kATCustomDataUserIDKey:@"test_custom_user_id",
    kATCustomDataChannelKey:@"custom_data_channel",
    kATCustomDataSubchannelKey:@"custom_data_subchannel",
    kATCustomDataAgeKey:@18,
    kATCustomDataGenderKey:@"male",
    kATCustomDataNumberOfIAPKey:@19,
    kATCustomDataIAPAmountKey:@20.0f,
    kATCustomDataIAPCurrencyKey:@"usd",
}; 

// Effective only for the current Placement
[[ATAPI sharedInstance] setCustomData:@{
    kATCustomDataChannelKey:@"placement_custom_data_channel",
    kATCustomDataSubchannelKey:@"placement_custom_data_subchannel"
} forPlacementID:@"your placementID"];

Unity

Copy
// Set custom Map info to match the configured ad source priority list (App level) (optional)
ATSDKAPI.initCustomMap(new Dictionary { { "unity3d_data", "test_data" } }); 

// Set custom Map info to match the configured ad source priority list (Placement level) (optional)
ATSDKAPI.setCustomDataForPlacementID(new Dictionary { { "unity3d_data_pl", "test_data_pl" } } ,placementId);
Previous
Cold Start Strategy
Next
SDK Preset Strategy
Last modified: 2026-07-02Powered by