Menu

ATAdManager

The base operation class for ads, including features such as ad loading, filtering ads, scenario statistics, and auction tools.

Copy
extern NSString *const kATAdAssetsNativeCustomEventKey;
extern NSString *const kATAdAssetsCustomEventKey;
extern NSString *const kATAdAssetsCustomObjectKey;
extern NSString *const kATExtraInfoRootViewControllerKey;
extern NSString *const kATAdAssetsDelegateObjKey;
extern NSString *const kATAdAssetsCustomNativeAdKey;
extern NSString *const kATAdAssetsCustomShowVcKey;

extern NSString *const kATAdLoadingExtraMediaExtraKey;
extern NSString *const kATAdLoadingExtraNetworkPlacementIDKey;
extern NSString *const kATAdLoadingExtraAdmobContentURLStringsKey;

/*
 * Banner ad size, the value is a CGSize type wrapped in an NSValue.
 * Currently, Banner ad loading only supports the (320.0f, 50.0f) size,
 * so the value passed through this key will be ignored.
 * Developers use kATAdLoadingExtraBannerAdSizeKey to set the Banner size. This key is not used.
 */
extern NSString *const kATExtraInfoAdSizeKey;
extern NSString *const kATAdLoadingExtraGDTEnableDefaultAudioSessionKey;

typedef BOOL(^AdSourceCustomizeFillterBlock)(NSDictionary *extra);

@protocol ATAdLoadingDelegate;

@interface ATAdManager : NSObject

@property (nonatomic,strong) NSDictionary *extra;
@property (nonatomic,strong) NSMutableDictionary *exludeUnitIDDic;
@property (nonatomic,strong) NSMutableDictionary *exludeNetworkFirmIDDic;
@property (nonatomic,strong) NSMutableDictionary *showingUnitIdDic;

@property(nonatomic, copy) AdSourceCustomizeFillterBlock adSourceCustomizeFillter;

/// Singleton object
+ (instancetype)sharedManager;

/// Called when loading an ad
/// @param placementID - TopOn placement ID
/// @param extra - Local configuration parameters
/// @param delegate - Delegate object
- (void)loadADWithPlacementID:(NSString *)placementID
                        extra:(NSDictionary *)extra
                     delegate:(id<ATAdLoadingDelegate>)delegate;

- (void)loadADWithPlacementID:(NSString *)placementID
                        extra:(NSDictionary *)extra
                      tkExtra:(nullable NSDictionary *)tkExtra
                adxFloorPrice:(nullable ATADXFloorPrice *)adxFloorPrice
                     delegate:(id<ATAdLoadingDelegate>)delegate;

// Filter target ad sources under the placement (by UnitID)
- (void)setExludePlacementid:(NSString *)placementid
                 unitIDArray:(NSArray <NSString *> *)unitIDArray;

/// Set the ad networks to be excluded when loading a placement. Takes effect on the next load.
/// @param placementid - TopOn placement ID
/// @param networkFirmIDArray - Array of ad network IDs to be excluded
- (void)setExludePlacementid:(NSString *)placementid
          networkFirmIDArray:(NSArray <NSNumber *> *)networkFirmIDArray;

/// Get ad extraInfo based on placementID and requestID
- (NSDictionary *)extraInfoForPlacementID:(NSString*)placementID
                                requestID:(NSString*)requestID;

/// Pass in the placement ID output to filter ad sources
- (void)setAdSourceCustomizeFillterPlacementIDArray:(NSArray <NSString *> *)placementIDArray;

/// Enter a scenario checkpoint (used for dashboard data statistics)
- (void)entryAdScenarioWithPlacementID:(NSString *)placementID scenarioID:(NSString *)scenarioID;

/// Check the cached ads based on the placement ID. The first item is the ad to be displayed next.
- (NSArray<NSDictionary *> *)getAdValidAdsForPlacementID:(NSString *)placementID;

/// Only notify us after custom closing an ad
/// @param placementID - TopOn placement ID
- (void)customCloseADEventWithPlacementID:(NSString *)placementID;

// Auction tool, bidding win/loss interfaces TODO ZSR optimize later
+ (void)trackWinWithPlacementID:(nonnull NSString *)placementID extra:(nullable NSDictionary*)extra;
+ (void)trackLossWithPlacementID:(nonnull NSString *)placementID extra:(nullable NSDictionary*)extra;

@end
Previous
Class
Next
ATBannerCustomEvent
Last modified: 2026-07-08Powered by