Menu

Taku ADX Client Bidding Integration

 

Client Bidding supports returning a specific price when ad fills. Publishers are able to use this function to compete with other ad networks on client end to determine the highest price ad, which will maximum gross revenue.

Below is the working flow of Client Bidding:

Step1、 Send ad request to Taku SDK and mediation SDK concurrently;

Step2、 Ad fills asynchronously from both side, and Taku will return a specific price once ad fills;

Step3、 When an ad opportunity takes place, publisher shall verify the status of each ads, if ads expire, remove the ads, otherwise the ads are ready to compete with each other

Step4、 Compare the price of ads and determine which ad could win this impression;

Step5、 If no ads win, or after finishing displaying the ad, repeat step1

* This document is only applicable to the in-house mediation integration mode exclusively for Taku ADX. For scenarios that require access to Taku's mediation features in addition to Taku ADX, please contact our Account Manager for integration assistance.

Android Guide

一、Prerequisites

  1. Android Taku SDK version >= 6.2.79

二、integration Guide

1. Create Taku AppId & Placement Id

Creation details:Taku Application Management

2. Integrate Taku SDK

Step 1:

You can integrate Taku SDK through this document :Android SDK Intergrate

Step 2 :

Before initializing the Taku SDK, call this code to set the advertising placement to Adx single mode. "TakuPlacementId" needs to be replaced with the corresponding Taku placement ID.

ATAdxSetting.getInstance().openAdxNetworkMode(TakuPlacementId);

Step 3:

You can start using the Taku SDK for Ad requests and impressions: Android SDK initialization

3. Get Price 

Please follow instruction of integrating each ad types. Then you can follow the below method to get price when an ad fills:

You can get "ATAdInfo" in the callback interface when the ad is loaded successfully, and then get the Ecpm of this ad through "getEcpm()" of ATAdInfo.

p.s: The currency unit returned by "getEcpm()" is consistent with the currency unit of the backend account, usually CNY or USD, which can be determined by adInfo.getCurrency();.

The sample code is as follows:

        // Native Ad
        ATNative atNative = new ATNative(context, "Your Placement Id", new ATNativeNetworkListener() {
            @Override
            public void onNativeAdLoaded() {
                ATAdStatusInfo adStatusInfo = atNative.checkAdStatus();
                ATAdInfo adInfo = adStatusInfo.getATTopAdInfo();
                String currency = adInfo.getCurrency();
                double ecpm = adInfo.getEcpm();
            }
        });

        // Rewarded Video
        ATRewardVideoAd rewardVideoAd = new ATRewardVideoAd(context, "Your Placement Id");
        rewardVideoAd.setAdListener(new ATRewardVideoListener() {
            @Override
            public void onRewardedVideoAdLoaded() {
                ATAdStatusInfo adStatusInfo = rewardVideoAd.checkAdStatus();
                ATAdInfo adInfo = adStatusInfo.getATTopAdInfo();
                String currency = adInfo.getCurrency();
                double ecpm = adInfo.getEcpm();

            }

        });

        // Interstitial
        ATInterstitial interstitial = new ATInterstitial(context, "Your Placement Id");
        interstitial.setAdListener(new ATInterstitialListener() {
            @Override
            public void onInterstitialAdLoaded() {
                ATAdStatusInfo adStatusInfo = interstitial.checkAdStatus();
                ATAdInfo adInfo = adStatusInfo.getATTopAdInfo();
                String currency = adInfo.getCurrency();
                double ecpm = adInfo.getEcpm();

            }

        });

        // App Open Ad
        ATSplashAd splashAd = new ATSplashAd(context, "Your Placement Id", new ATSplashAdListener() {
            @Override
            public void onAdLoaded(boolean isTimeout) {
                ATAdStatusInfo adStatusInfo = interstitial.checkAdStatus();
                ATAdInfo adInfo = adStatusInfo.getATTopAdInfo();
                String currency = adInfo.getCurrency();
                double ecpm = adInfo.getEcpm();

            }

        });


        // Banner Ad
        ATBannerView bannerView = new ATBannerView(context);
        bannerView.setPlacementId("Your Placement Id");
        bannerView.setBannerAdListener(new ATBannerListener() {
            @Override
            public void onBannerLoaded() {
                ATAdStatusInfo adStatusInfo = bannerView.checkAdStatus();
                ATAdInfo adInfo = adStatusInfo.getATTopAdInfo();
                String currency = adInfo.getCurrency();
                double ecpm = adInfo.getEcpm();

            }

        });

4. Auction

4.1 Taku Adx win

If Taku wins, you should pass the highest price of second bidder to Taku before you show the ad. This step will help us to optimize performance

Note: The price currency unit passed in SECOND_PRICE must be US dollars

public void sendAdxWin(ATRewardVideoAd rewardVideoAd, double secondPrice, String secondPriceBidderName) {
    ATAdStatusInfo adStatusInfo = rewardVideoAd.checkAdStatus();
    ATAdInfo adInfo = adStatusInfo.getATTopAdInfo();
    IATAdxHandler adxHandler = adInfo.getAdxHandler();
    // If the currency type of the second price is RMB, we can use our tool method to get the current exchange rate, and then convert it into US dollars.
    //secondPrice = getRmbToUsdPrice(secondPrice);
    if (adxHandler != null) {
        Map winExtraMap = new HashMap<>();
        winExtraMap.put(IATAdxHandler.SECOND_PRICE, secondPrice);//: double,Currency required USD
        //Loss Network Name
        winExtraMap.put(IATAdxHandler.BIDDER_NAME, secondPriceBidderName);//: String
        adxHandler.notifyWin(winExtraMap);
    }
}

// RMB to USD
public double getRmbToUsdPrice(double rmbPrice) {
    double rate = ATSDKUtils.getUsdChangeToRmbRate();
    if (rate > 0) {
        return rmbPrice / rate;
    }
    return rmbPrice;
}
  

4.2 Taku Adx loss

If Taku losses, you should pass the price of first bidder to Taku before you show the ad. This step will help us to optimize performance

Note: The price currency unit passed by winEcpm must be US dollars

public void sendAdxLose(ATRewardVideoAd rewardVideoAd, IATAdxHandler.LOSS_REASON lossReason, double winnerEcpm, String bidderName) {
    ATAdStatusInfo adStatusInfo = rewardVideoAd.checkAdStatus();
    ATAdInfo adInfo = adStatusInfo.getATTopAdInfo();
    IATAdxHandler adxHandler = adInfo.getAdxHandler();
    if (adxHandler != null) {
        Map lossExtraMap = new HashMap<>();
        //Win Network Name
        lossExtraMap.put(IATAdxHandler.BIDDER_NAME, bidderName);//: String

        //  If the currency type of the winner price is RMB, you can use our tool method to get the current exchange rate, and then convert it into US dollars.
        //winnerEcpm = getRmbToUsdPrice(winnerEcpm);
        /**
         * @param lossReason // loss reason
         * @param winnerEcpm // win price,Currency required USD
         * @param lossExtraMap // loss extra info
         */
        adxHandler.notifyLose(lossReason, winnerEcpm, lossExtraMap);
    }
}

// RMB to USD
public double getRmbToUsdPrice(double rmbPrice) {
    double rate = ATSDKUtils.getUsdChangeToRmbRate();
    if (rate > 0) {
        return rmbPrice / rate;
    }
    return rmbPrice;
}

 LossReason:

Code Description
 

IATAdxHandler.LOSS_REASON.LOSS_TO_HIGHER_BID

The adx price is lower than the higher priced auction ad
IATAdxHandler.LOSS_REASON.LOSS_TO_NORMAL
The price of adx is lower than higher priced fixed price ads (non-auction ads)

 5.Show Ads

If Taku wins, please refer to Android SDK Intergrate and show Taku ads

iOS Guide

一、Prerequisites

  1. iOS Taku SDK version >= 6.2.76

二、integration Guide

1. Create Taku AppId & Placement Id

Creation details:Taku Application Management

 2. Integrate Taku SDK

Step 1:

You can integrate Taku SDK through this document :iOS SDK Intergrate

Step 2 :

Before initializing the Taku SDK, call this code to set the advertising placement to Adx single mode. Once this mode is enabled, it will take effect during the current app startup cycle and cannot be reset. "TakuPlacementId" needs to be replaced with the corresponding Taku placement ID.

[[ATADXSettings shareInstance] setAdxNetworkModeWithPlacementId:@"TakuPlacementId"];

Step 3:

You can start using the Taku SDK for Ad requests and impressions: iOS SDK initialization

3. Get Price 

Please follow instruction of integrating each ad types. Then you can follow the below method to get price when an ad fills:

After the ad is loaded successfully, you can call the API interface of the corresponding ad style to get the valid cache list in the loading success callback interface to get the validAds array, and then get the first cache information "adOfferInfo" through the validAds array. Through the "adOfferInfo" dictionary information key, take the value of "adsource_price" to get the Ecpm of the ad.

p.s: The currency unit returned by "adsource_price" is consistent with the currency unit under the background account, usually RMB (CNY) or US dollar (USD), which can be determined by adOfferInfo[@"currency"]. For more key values, please refer to the official website document: Callback Description

The sample code is as follows:

- (void)didFinishLoadingADWithPlacementID:(NSString *)placementID {
    // RewardedVideo
    NSArray *validAds = [[ATAdManager sharedManager] getRewardedVideoValidAdsForPlacementID:@"Your Placement Id"];
    NSDictionary *adOfferInfo = validAds.firstObject;
    NSString *ecpm = adOfferInfo[@"adsource_price"];
    NSString *currency = adOfferInfo[@"currency"];
    
    // InterstitialLoad
    NSArray *validAds = [[ATAdManager sharedManager] getInterstitialValidAdsForPlacementID:@"Your Placement Id"];
    NSDictionary *adOfferInfo = validAds.firstObject;
    NSString *ecpm = adOfferInfo[@"adsource_price"];
    NSString *currency = adOfferInfo[@"currency"];
    
    // Native
    NSArray *validAds = [[ATAdManager sharedManager] getNativeValidAdsForPlacementID:@"Your Placement Id"];
    NSDictionary *adOfferInfo = validAds.firstObject;
    NSString *ecpm = adOfferInfo[@"adsource_price"];
    NSString *currency = adOfferInfo[@"currency"];
    
    // Banner
    NSArray *validAds = [[ATAdManager sharedManager] getBannerValidAdsForPlacementID:@"Your Placement Id"];
    NSDictionary *adOfferInfo = validAds.firstObject;
    NSString *ecpm = adOfferInfo[@"adsource_price"];
    NSString *currency = adOfferInfo[@"currency"];
    
    // Splash
    NSArray *validAds = [[ATAdManager sharedManager] getSplashValidAdsForPlacementID:@"Your Placement Id"];
    NSDictionary *adOfferInfo = validAds.firstObject;
    NSString *ecpm = adOfferInfo[@"adsource_price"];
    NSString *currency = adOfferInfo[@"currency"];
}

 4. Auction

Please refer to the acquisition method in the third point above. After obtaining the array according to different ad types, call the following method to obtain adxObject. This object can be used for subsequent Adx winning and losing operations. Take rewarded video ads as an example:

// RewardedVideo
NSArray *validAds = [[ATAdManager sharedManager] getRewardedVideoValidAdsForPlacementID:@"Your Placement Id"];
NSDictionary *adOfferInfo = validAds.firstObject;
ATADXObject *adxObject = adOfferInfo[@"adx_object"];

4.1 Taku Adx win

If Taku wins, you should pass the highest price of second bidder to Taku before you show the ad. This step will help us to optimize performance

Note: The price currency unit passed in kATADXObjectSecondLossPrice must be US dollars

- (void)sendWinNotification {
    // RewardedVideo
    NSArray *validAds = [[ATAdManager sharedManager] getRewardedVideoValidAdsForPlacementID:@"Your Placement Id"];
    NSDictionary *adOfferInfo = validAds.firstObject;
    ATADXObject *adxObject = adOfferInfo[@"adx_object"];
    //  send win
    NSString *secondLossPrice = @"The second price is in US dollars.";
    //  If the currency type of the second price is RMB, we can use our tool method to get the current exchange rate, and then convert it into US dollars.
//    NSString *secondLossPrice = [self getExchRateC2UWithRMBPrice:@"Price in RMB" placementID:@"Your PlacementID"];
    
    [adxObject sendWinNotificationWithInfo:@{
        kATADXObjectNetwokName: @"Second ad netwok name",
        kATADXObjectSecondLossPrice: secondLossPrice
    }];
}

// RMB to USD
- (NSString *)getExchRateC2UWithRMBPrice:(NSString *)price placementID:(NSString *)placementID {
    NSString *tempPriceStr = price;
    NSDecimalNumber *priceDecimal = [NSDecimalNumber decimalNumberWithString:price];
    NSDecimalNumber *rateDecimal = [NSDecimalNumber decimalNumberWithString:[ATBidInfo getExchRateC2U:placementID]];
    
    if (![priceDecimal isEqualToNumber:NSDecimalNumber.notANumber] && ![rateDecimal isEqualToNumber:NSDecimalNumber.notANumber]) {
        tempPriceStr = [[priceDecimal decimalNumberByMultiplyingBy:rateDecimal] stringValue];
    }
    return tempPriceStr;
}
  

4.1 Taku Adx loss

If Taku losses, you should pass the price of first bidder to Taku before you show the ad. This step will help us to optimize performance

Note: The price currency unit passed by kATADXObjectWinPrice must be US dollars

- (void)sendLossNotification {
    // RewardedVideo
    NSArray *validAds = [[ATAdManager sharedManager] getRewardedVideoValidAdsForPlacementID:@"Your Placement Id"];
    NSDictionary *adOfferInfo = validAds.firstObject;
    ATADXObject *adxObject = adOfferInfo[@"adx_object"];

    NSString *winPrice = @"win price, Currency required USD";
    // If the currency type of the competitive price is RMB, you can use our tool method to get the current exchange rate, and then convert it into US dollars.
//    NSString *winPrice = [self getExchRateC2UWithRMBPrice:@"Price in RMB" placementID:@"Your PlacementID"];

    // send loss
    [adxObject sendLossNotificationWithInfo:@{
        kATADXObjectNetwokName: @"win ad network name",
        kATADXObjectWinPrice: winPrice,
        kATADXObjectLossReason: kATADXObjectLossReasonBidLowPrice,//If the price is lower than other bidding ad sources
    }];
}

// RMB to USD
- (NSString *)getExchRateC2UWithRMBPrice:(NSString *)price placementID:(NSString *)placementID {
    NSString *tempPriceStr = price;
    NSDecimalNumber *priceDecimal = [NSDecimalNumber decimalNumberWithString:price];
    NSDecimalNumber *rateDecimal = [NSDecimalNumber decimalNumberWithString:[ATBidInfo getExchRateC2U:placementID]];
    
    if (![priceDecimal isEqualToNumber:NSDecimalNumber.notANumber] && ![rateDecimal isEqualToNumber:NSDecimalNumber.notANumber]) {
        tempPriceStr = [[priceDecimal decimalNumberByMultiplyingBy:rateDecimal] stringValue];
    }
    return tempPriceStr;
}

 LossReason:

Code Description
 

kATADXObjectLossReasonBidLowPrice

The adx price is lower than the higher priced auction ad
kATADXObjectLossReasonLowPrice
The price of adx is lower than higher priced fixed price ads (non-auction ads)

 5.Show Ads

If Taku wins, please refer to iOS SDK Intergrate and show Taku ads

Previous
App-ads.txt and Sellers.json
Next
Klevin
Last modified: 2025-05-30Powered by