Note: Custom ad platforms do not support integration verification functionality.
Call the following code to enable logging and integration detection:
#import <AnyThinkSDK/AnyThinkSDK.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[ATAPI setLogEnabled:YES];//Turn on debug logs
[ATAPI integrationChecking];
....
return YES;
}
Based on the output logs, check whether the SDK integration of each ad platform is normal.
The following table explains the meaning of each field:
Field | Note |
---|---|
Status | Status of integrated ad platform SDK |
Reason | Reason for integration issues |
Recommended Versions | Recommended third-party SDK versions to import |
Use Versions | Third-party SDK versions imported by users |
Please go to the DebugUI debugging tool section.
Taku dashboard ad placement configuration takes effect in about 5-15 minutes. After you modify related ad placement settings (such as adding or modifying ad sources), you may need to wait before they take effect.
SDK provides sandbox caching for dashboard configurations for 30 minutes. After you modify configurations, you need to wait for the cache time to end before requesting the latest dashboard configuration (expired cache will still use old configuration for that request).
You can choose one of the following three processes for testing based on your current development stage.
After you complete configuration in Taku dashboard and other ad platform dashboards, use the online ID testing function of DebugUI debugging tool to quickly verify whether these configurations are correct.
Note: Custom ad platforms are not supported.
#import <AnyThinkSDK/AnyThinkSDK.h>
// Set test IDFA, such as Meta ad test devices
[ATAPI setHeaderBiddingTestModeWithDeviceID:@"you device idfa"];
// Note: Calling this code will use server-delivered ad configuration for ad requests. If testing is complete and you need to use your own ad configuration, remove this code.
[ATAPI setDebuggerConfig:^(ATDebuggerConfig *debuggerConfig) {
// Device idfa
debuggerConfig.deviceIdfaStr = @"you device idfa";
// Specify test ad platform, see header file for other platform types
debuggerConfig.netWorkType = ATAdNetWorkCSJType;
// Specify Pangle specific ad type
debuggerConfig.csj_nativeAdType = ATCSJNativeAdFeedSelfRenderType;
}];
Remove DebugUI SDK, turn off debug mode, and fully use your app's ad display logic and Taku dashboard configuration for testing.
This can be achieved by configuring traffic groups and adding custom rules. First, refer to creating traffic groups with custom key-value rules. Put the ad sources to be tested in each traffic group (for example, traffic group A only contains Kuaishou, traffic group B only contains Tencent, here we demonstrate simulating Baidu), then test through the following code. (After adding the code, wait a few minutes for the dashboard traffic group configuration to take effect, then delete and reinstall the app for verification). For example:
⚠️Note
- Remember to delete the test setCustomData code after debugging.
- The following code is only for custom rules or custom rules (new).
- You may need to add your test devices in each ad platform dashboard (if supported by the ad platform).
After dashboard modification, it takes about 5 minutes to take effect; local policy cache sandbox is 30 minutes. It is recommended to delete the app to clear sandbox cache after it takes effect, then request again.
//Set before calling various types of ad loading (load) APIs. Remember to delete the test setCustomData code after debugging
[[ATSDKGlobalSetting sharedManager] setCustomData:@{@"istest":@"yes"} forPlacementID:xxxx];
//Note: xxx is the actual parameter in the code
[[ATAdManager sharedManager] loadADWithPlacementID:xxx extra:xxx delegate:xxx];
You can create test traffic groups and add your test device's IDFA. Then copy or create one or several ad sources you want to debug, wait for configuration to take effect, clear local cache, allow SDK to get IDFA (you can see SDK printing IDFA in initialization logs for success), then initiate ad loading to attach device IDFA information for ad requests. If your ad loading request is made after getting IDFA, you need to adjust system time 30 minutes later, return to the app and request again, and repeat this operation once to update sandbox policy cache.
Test Ads: Please go to ad platform dashboard to add test devices (if supported by ad platform).
Production Ads: Cannot control fill rate, affected by multiple factors. Tips to increase production non-bidding ad fill rate: 1. Lower fixed price configuration; 2. Try more node devices for overseas ad platforms; For overseas projects, please check if app-ads.txt is correctly configured before testing production bidding ads (both Taku and third-party platforms need to be checked. For third-party ad platforms, please refer to their documentation for app-ads.txt configuration tutorials).
Ad source delegate methods can output original information from third-party ad platform SDKs, which is very useful for troubleshooting ad loading failure reasons.
One ad placement can configure multiple ad sources. To receive loading events for a specific ad source, you need to use ad source level delegate callback methods. If all ad sources fail to request, or the ad placement overall request times out, use ad placement level failure callback to receive events.
After enabling SDK log switch, SDK will print ad source loading failure information by default. If you want to collect and print this information yourself, please implement these delegate methods.
If your ad sources include bidding ads, you need to implement the following BiddingADSource delegate methods to get ad source bidding related information.
Print the description field in error object to view detailed error information. You can go to Error Code Description document to view error code meanings.
#pragma mark - Ad Source Level Callbacks
- (void)didStartLoadingADSourceWithPlacementID:(NSString *)placementID extra:(NSDictionary*)extra {
NSLog(@"Ad Source--AD--Start--didStartLoadingADSourceWithPlacementID:%@---extra:%@", placementID,extra);
}
- (void)didFinishLoadingADSourceWithPlacementID:(NSString *)placementID extra:(NSDictionary*)extra {
NSLog(@"Ad Source--AD--Finish--didFinishLoadingADSourceWithPlacementID:%@---extra:%@", placementID,extra);
}
- (void)didFailToLoadADSourceWithPlacementID:(NSString*)placementID extra:(NSDictionary*)extra error:(NSError*)error {
NSLog(@"Ad Source--AD--Fail--didFailToLoadADSourceWithPlacementID:%@---error:%@", placementID,error);
}
/*
If your ad sources include bidding ads, you need to implement the following delegate methods to get ad source bidding process information. If bidding fails, you can provide related failure information and give us feedback, or directly check third-party platform error code descriptions.
*/
#pragma mark - Ad Source Level Callbacks - Bidding
- (void)didStartBiddingADSourceWithPlacementID:(NSString *)placementID extra:(NSDictionary*)extra {
NSLog(@"Ad Source--bid--Start--didStartBiddingADSourceWithPlacementID:%@---extra:%@", placementID,extra);
}
- (void)didFinishBiddingADSourceWithPlacementID:(NSString *)placementID extra:(NSDictionary*)extra {
NSLog(@"Ad Source--bid--Finish--didFinishBiddingADSourceWithPlacementID:%@--extra:%@", placementID,extra);
}
- (void)didFailBiddingADSourceWithPlacementID:(NSString*)placementID extra:(NSDictionary*)extra error:(NSError*)error {
NSLog(@"Ad Source--bid--Fail--didFailBiddingADSourceWithPlacementID:%@--extra:%@--error:%@", placementID, extra, error);
}
#pragma mark - Ad Placement Level Callbacks - All Ad Sources Loading Complete
//Success - Some ad source loaded successfully
- (void)didFinishLoadingADWithPlacementID:(NSString *)placementID {
NSLog(@"didFinishLoadingADWithPlacementID:%@", placementID);
}
//Failure - No ad source loaded successfully
- (void)didFailToLoadADWithPlacementID:(NSString *)placementID error:(NSError *)error {
NSLog(@"didFailToLoadADWithPlacementID:%@ error:%@", placementID, error);
}
Here is an actual printing case. Usually you need to pay attention to the following points when troubleshooting:
ATAdLogger(UA_6.4.87) Message:didFailBiddingADSourceWithPlacementID:b5bacaccb61c29extra:{
adunit_id = "b5bacaccb61c29";
currency = "USD";
adsource_price = 0;
req_id = "cee21cc4b7ae08706a1a3ef3fc9060ba";
abtest_id = 609;
s_id = 100172;
usd_to_rmb_rate = "1";
rmb_to_usd_rate = "0.1393";
network_firm_id = 58;
adsource_id = "2560962";
network_placement_id = "9";
adsource_bid_type = 2;
}error:Error Domain=com.anythink.PubNativeSDK Code=1 "AnythinkSDK has failed to load native ad." UserInfo={NSLocalizedDescription=AnythinkSDK has failed to load native ad., NSLocalizedFailureReason=Error Domain=net.pubnative.PubnativeLite Code=1 "HyBid - No fill" UserInfo={NSLocalizedDescription=HyBid - No fill}}
You can quickly get the following debugging information through console printed log information.
Log Example:
{
action = "request_result"; //Action after initiating ad loading: request (ad request), request_result (ad return result), impression (ad display), click (ad click), close (ad close)
"ad_type" = reward; //Ad placement type for loading: Native/inter/RewardVideo/Banner/Splash
"adsource_id" = 12300; //Ad source id
auto = NO; //Whether it's automatic request
"daily_frequency" = 0; //Number of displays the day before
"hourly_frequency" = 0; //Number of displays in current hour
defaultAdSourceType = 0; //Whether it's fallback ad source
isheaderbidding = 0; //Whether it's bidding ad source
msg = "Error Domain=Wind Code=600008 \"\U8bf7\U6c42\U8d85\U65f6\U3002\" UserInfo={NSLocalizedDescription=\U8bf7\U6c42\U8d85\U65f6\U3002}"; //If loading fails, complete error information will be output here
network = Sigmob; //Represents third-party platform
"network_firm_id" = 29; //Represents third-party platform's network_firm_id
"network_list" = (
Sigmob
);//Current third-party ad request list id, separated by ","
"network_unit_info" = {
"app_id" = 19761;
"app_key" = 7064a19c108082ef;
"placement_id" = ea1f8f7b662;
}; //Corresponding third-party ad platform app and placement information
"placement_id" = b5d771f5a3458f; //Ad placement id that initiated loading
position = 0; //Current ad source sort position
refresh = 0; //Whether it's auto refresh
"request_network_num" = 1; //How many third-party ad platform loadings are initiated simultaneously
result = fail; //Result parameter: success, fail
"sdk_version" = "4.2.1"; //Third-party platform SDK version
"segment_id" = 0; //Traffic group id
}
Taku ads are divided into waterfall ads and bidding ads. The loading process of these two types of ads is slightly different. Bidding ads will first get bidding tokens without initiating loading yet, while waterfall ads directly initiate ad requests to ad platforms.
Initiate Ad Source Ad Request, search for "AD Request offer with network info:" in console, result as shown:
Annotations in the figure:
① Ad source layer in ad placement initiates request
② Which ad platform the ad source layer in ad placement is, locate which ad platform
③ Related information of ad source platform in ad placement, ad platform information configured in Taku.
Ad Source Ad Request Success, search for "handler success Request offer with network info:" in console, result as shown:
Annotations in the figure:
① Ad source layer in ad placement request successful
② Which ad platform the ad source layer in ad placement is
③ SDK version of ad source platform in ad placement, can know the imported third-party platform SDK version
④ Traffic group id for ad placement loading, can know which traffic group is loaded, 0 represents default group
Ad Source Ad Request Failure, search for "handler fail Request offer with network info:" in console, result as shown:
Annotations in the figure:
① Ad source layer in ad placement request failed.
② Ad source layer loading failure information in ad placement. Based on which platform's ad, use error information to check corresponding platform's error codes.
③ Which ad platform the ad source layer in ad placement is.