### HotCloud click monitoring link with install callback Source: https://help.toponad.net/docs/Click-URL-Configuration-Instructions Optional install callback example adding &callback=http%3A%2F%2Fpostback.mosspf.net%2Finstall%3Fclick_id%3D{clickid} to send installation data back to Taku. ```url // Supplementary placeholder example https://uri6.com/tkio/abc?imei={imei}&mac={mac}&androidid={androidid}&oaid={oaid}&ip={ip}&clickid={clickid}&_ry_adplan_id={app_id}&_ry_adcreative_id={placement_id}&callback=http%3A%2F%2Fpostback.mosspf.net%2Finstall%3Fclick_id%3D{clickid} ``` -------------------------------- ### Return sample for Get Placement List Source: https://help.toponad.net/docs/Placement-API Example response from the Get Placement List API, showing an array of placement objects with fields such as app_name, app_id, platform, placement_id, placement_name, and adformat. ```json [ { "app_name": "topontest", "app_id": "a5bc9921f7fdb4", "platform": 2, "placement_id": "b5bc9bc2951216", "placement_name": "topontest_rewardvideo", "adformat": "rewarded_video" } ] ``` -------------------------------- ### Adjust install postback URL with placeholders Source: https://help.toponad.net/docs/Click-URL-Configuration-Instructions Postback URL for Adjust to send installation data back to TopOn. {clickid} is a placeholder for the click ID. ```text https://postback.mosspf.net/install?click_id={clickid} ``` -------------------------------- ### Callback URL Example Source: https://help.toponad.net/docs/Serverside-incentives An example of the full callback URL structure including all available query parameters. ```text https://www.toponad.com/onrewardedverify?user_id={user_id}&trans_id={trans_id}&reward_amount={reward_amount}&reward_name={reward_name}&placement_id={placement_id}&extra_data={extra_data}&network_firm_id={network_firm_id}&adsource_id={adsource_id}&scenario_id={scenario_id}&sign={sign}&ilrd={ilrd} ``` -------------------------------- ### Display native ad with scenario using ATConst.SCENARIO Source: https://help.toponad.net/docs/Native-Ads-Integration-Instructions Shows how to use the scenario feature by adding the SCENARIO key from AnyThinkAds.Api.ATConst to a Dictionary and passing it as the third parameter to renderAdToScene. The ellipsis (...) represents the same configuration and setup as the basic showNative example. ```csharp public void showNative() { ... Dictionary jsonmap = new Dictionary(); jsonmap.Add(AnyThinkAds.Api.ATConst.SCENARIO, showingScenarioID); ATNativeAd.Instance.renderAdToScene(mPlacementId_native_all, anyThinkNativeAdView, jsonmap); } ``` -------------------------------- ### ATMediaVideoOffer start Source: https://help.toponad.net/docs/6WN1x8ha Starts playing the ad. ```APIDOC ## [POST] /start ### Description Starts playing the ad. ### Method POST ### Endpoint /start ### Parameters No parameters. ### Request Example No request body. ### Response #### Success Response (200) - **void** - No return value. #### Response Example No response body. ``` -------------------------------- ### Example click link URL Source: https://help.toponad.net/docs/Click-URL-Configuration-Instructions Example click link for Adjust: https://app.adjust.com/cbtest ```text https://app.adjust.com/cbtest ``` -------------------------------- ### MaterialMonitor.init / get / getConfig Source: https://help.toponad.net/docs/tjwNgGMm Initialization and access methods for the MaterialMonitor singleton. Use init to configure the SDK, get to retrieve the instance, and getConfig to read the initial configuration. ```APIDOC ## MaterialMonitor.init / get / getConfig ### Description Initialization and access methods for the MaterialMonitor singleton. Use init to configure the SDK, get to retrieve the instance, and getConfig to read the initial configuration. ### Methods #### `static void init(Application application)` - **Description**: Uses the default `MaterialMonitorConfig` (without upload parameters). Suitable only for scenarios where data is only written to disk and no gateway is connected. - **Parameters**: - `application` (Application) - Required - The application context. #### `static void init(Application application, MaterialMonitorConfig config)` - **Description**: Recommended. When `config` cannot be null, use `DEFAULT`, which is equivalent to an empty configuration. - **Parameters**: - `application` (Application) - Required - The application context. - `config` (MaterialMonitorConfig) - Required - The configuration object; cannot be null. #### `static MaterialMonitor get()` - **Description**: Retrieves the singleton instance. Returns an **idle** placeholder instance if `init` is not initialized or `shutdown` has been initialized (for `collect*`, etc., it is no-op and logs a warning), **without throwing an exception**. - **Returns**: `MaterialMonitor` - The singleton instance. #### `static boolean isReady()` - **Description**: Has it been initialized and not yet shut down? (A real instance can be lazily created during the first `get()`.) - **Returns**: `boolean` - `true` if initialized and not shut down, `false` otherwise. #### `static void shutdown()` - **Description**: Release lifecycle callbacks and worker; SQLite rows to be uploaded are retained and can be resumed by `init` later. #### `MaterialMonitorConfig getConfig()` - **Description**: Read the initial configuration; you can call `isUploadConfigured()` to check if it has `baseUploadUrl + appId + appKey`. - **Returns**: `MaterialMonitorConfig` - The initial configuration. ``` -------------------------------- ### load() Source: https://help.toponad.net/docs/Splash-Ad-wwJ3 Starts loading the splash ad. ```APIDOC ## void load() ### Description Initiate ad loading. ``` -------------------------------- ### Configure Start.io Debug Mode Source: https://help.toponad.net/docs/How-to-test-ads General setup for Start.io debug mode. ```java // General setup ATSDK.setDebuggerConfig(context, GAID, new ATDebuggerConfig.Builder(StartApp_NETWORK).build()); ``` -------------------------------- ### Request sample for Get Placement List Source: https://help.toponad.net/docs/Placement-API JSON payload for the POST request to https://api.toponad.net/v1/placements. The example filters by placement_ids, but app_ids, start, and limit are also optional parameters. ```json { "placement_ids":["b5bc9bc2951216"] } ``` -------------------------------- ### Get A/B Test List - Request Sample Source: https://help.toponad.net/docs/A-B-Test Sample request body for the GET /v3/abtest endpoint. The example filters by name 'test'. ```json { "name": "test" } ``` -------------------------------- ### Get Mediation Segment Request URL Source: https://help.toponad.net/docs/Segment-API Example of the GET request URL used to retrieve segment groups for a specific mediation group ID. ```text https://api.toponad.net/v3/mediation_segment/116112 ``` -------------------------------- ### Configure Start.io Debug Mode Source: https://help.toponad.net/docs/How-to-test-ads Use TUSDK.setDebuggerConfig to set up Start.io. ```java // General setup TUSDK.setDebuggerConfig(context, GAID, new TUDebuggerConfig.Builder(StartApp_NETWORK).build()); ``` -------------------------------- ### ATMediaVideoViewController sample code (Objective-C) Source: https://help.toponad.net/docs/6WN1x8ha This snippet shows the implementation of setUpContentPlayer, loadAd, and showAd methods for media video ads. It sets up an AVPlayer with a content URL, loads an ad with extra parameters, and displays it, including registering friendly obstructions for overlays and pause button. Note the use of IMAFriendlyObstruction and the conditional handling for VMAP and VAST offer types. ```Objective-C - (IMAAVPlayerContentPlayhead *)setUpContentPlayer { // Load AVPlayer with path to our content. NSURL *contentURL = [NSURL URLWithString:kTestAppContentUrl_MP4]; self.contentPlayer = [AVPlayer playerWithURL:contentURL]; // Create a player layer for the player. AVPlayerLayer *playerLayer = [AVPlayerLayer playerLayerWithPlayer:self.contentPlayer]; // Size, position, and display the AVPlayer. playerLayer.frame = self.videoView.layer.bounds; [self.videoView.layer addSublayer:playerLayer]; // Set up our content playhead and contentComplete callback. IMAAVPlayerContentPlayhead *contentPlayhead = [[IMAAVPlayerContentPlayhead alloc] initWithAVPlayer:self.contentPlayer]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(contentDidFinishPlaying:) name:AVPlayerItemDidPlayToEndTimeNotification object:self.contentPlayer.currentItem]; return contentPlayhead; } - (void)loadAd { [[ATAPI sharedInstance] setCustomData:self.currentPlacementIDInfoRuleModel.groupRuleDic forPlacementID:self.currentPlacementIDInfoModel.placementIDString]; if (!self.videoView.superview) { [self.view addSubview:self.videoView]; self.contentPlayhead = [self setUpContentPlayer]; } [self.contentPlayer seekToTime:kCMTimeZero completionHandler:^(BOOL finished) { }]; NSMutableDictionary *extra = @{}.mutableCopy; // Open in internal browser extra[kATAdMediaVideoExtraKeyInternalBrowserViewController] = self; // Hide countdown extra[kATAdMediaVideoExtraKeyHideCountDown] = @NO; // Video ad load timeout duration extra[kATAdMediaVideoExtraKeyLoadVideoTimeout] = @8; // Whether the ad should auto-play; only effective for VMAP extra[kATAdMediaVideoExtraKeyAutoPlayAdBreaks] = @NO; // Disable current playback info extra[kATAdMediaVideoExtraKeyDisableNowPlayingInfo] = @YES; [[ATAdManager sharedManager] loadADWithPlacementID:self.currentPlacementIDInfoModel.placementIDString extra:extra controlDataParam:@{@"description_url":@"description_url"} delegate:self mediaVideoContainerView:self.videoView viewController:self]; } - (void)showAd { if (![[ATAdManager sharedManager] adReadyForPlacementID:self.currentPlacementIDInfoModel.placementIDString]) { return; } ATShowConfig *showConfig = [[ATShowConfig alloc] initWithScene:nil showCustomExt:@"testShowCustomExt"]; self.offer = [[ATAdManager sharedManager] mediaVideoObjectWithPlacementID:self.currentPlacementIDInfoModel.placementIDString showConfig:showConfig delegate:self]; [[ATAdManager sharedManager] entryMediaVideoScenarioWithPlacementID:self.currentPlacementIDInfoModel.placementIDString scene:@"11"]; id customNetworkObj = [self.offer customNetworkObj]; id adsManager = [self.offer adsManager]; [self.contentPlayer seekToTime:kCMTimeZero completionHandler:^(BOOL finished) { }]; UIView *myTransparentTapOverlay = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 250)]; myTransparentTapOverlay.backgroundColor = [UIColor yellowColor]; UIButton *myPauseButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 50, 10)]; // Substitute "myTransparentTapOverlay" and "myPauseButton" with the elements // you want to register as video controls overlays. // Make sure to register before ad playback starts. IMAFriendlyObstruction *overlayObstruction = [[IMAFriendlyObstruction alloc] initWithView:myTransparentTapOverlay purpose:IMAFriendlyObstructionPurposeNotVisible detailedReason:@"This overlay is transparent"]; IMAFriendlyObstruction *pauseButtonObstruction = [[IMAFriendlyObstruction alloc] initWithView:myPauseButton purpose:IMAFriendlyObstructionPurposeMediaControls detailedReason:@"This is the video player pause button"]; [self.offer registerFriendlyObstruction:overlayObstruction]; [self.offer registerFriendlyObstruction:pauseButtonObstruction]; [self.offer unregisterAllFriendlyObstructions]; if (self.offer.type == ATMediaVideoOfferTypeVMAP) { [self.offer contentPlayhead:self.contentPlayhead]; } else if (self.offer.type == ATMediaVideoOfferTypeVAST) { [self.offer start]; } } ``` -------------------------------- ### Request URL Sample Source: https://help.toponad.net/docs/Waterfall-API Example of the GET request URL for retrieving ad sources. ```text https://api.toponad.net/v3/waterfall/116112/segment_id/600262/abtest_group_item_id/0/units ``` -------------------------------- ### Unity Reward Video Incentive Setup Source: https://help.toponad.net/docs/Serverside-incentives Use a Dictionary to pass user ID and extra data to the loadVideoAd method. ```csharp Dictionary jsonmap = new Dictionary(); jsonmap.Add(ATConst.USERID_KEY, "test_user_id"); jsonmap.Add(ATConst.USER_EXTRA_DATA, "test_user_data"); ATRewardedVideo.Instance.loadVideoAd(placementId, jsonmap); ``` -------------------------------- ### Displaying MediaVideoAd with IMA Event Handling Source: https://help.toponad.net/docs/InStream-Video-Ads This example demonstrates how to check if an ad is ready, configure the display container, set the content progress provider for VMAP, and handle various IMA ad events to control content playback and ad lifecycle. ```java if (mATMediaVideo.isAdReady()) { if (mMediaVideoAd != null) { //destroy showing media video ad mMediaVideoAd.onDestroy(); mMediaVideoAd = null; } //reset player state and content video play position mVideoPlayerWithAdPlayback.resetInnerVideoPlayerAndParams(); ATShowConfig showConfig = new ATShowConfig.Builder().scenarioId("your scenario id").build(); mMediaVideoAd = mATMediaVideo.getMediaVideoAd(showConfig); mVideoPlayerWithAdPlayback.setReadyToPlayContent(true); //must setContainer(container) before start() if (mVideoPlayerWithAdPlayback.getAdUiContainer() != null) { mVideoPlayerWithAdPlayback.getAdUiContainer().removeAllViews(); } //need setContainer mMediaVideoAd.setContainer(mVideoPlayerWithAdPlayback.getAdUiContainer()); //setContentProgressProvider(VMAP need) mMediaVideoAd.setContentProgressProvider(mVideoPlayerWithAdPlayback.getContentProgressProvider()); //Call setOnIMAEventListener to bind MediaVideoAd and OnIMAEventListener mMediaVideoAd.setOnIMAEventListener(new OnIMAEventListener() { @Override public void onEvent(Object adEvent) { /** * do content resume、pause and start、destroy MediaVideoAd */ if (adEvent instanceof AdEvent) { switch (((AdEvent) adEvent).getType()) { case LOADED: // AdEventType.LOADED will be fired when ads are ready to be // played. AdsManager.start() begins ad playback. This method is // ignored for VMAP or ad rules playlists, as the SDK will // automatically start executing the playlist. break; case CONTENT_PAUSE_REQUESTED: // AdEventType.CONTENT_PAUSE_REQUESTED is fired immediately before // a video ad is played. mVideoPlayerWithAdPlayback.pauseContentForAdPlayback(); break; case CONTENT_RESUME_REQUESTED: // AdEventType.CONTENT_RESUME_REQUESTED is fired when the ad is // completed and you should start playing your content. mVideoPlayerWithAdPlayback.resumeContentAfterAdPlayback(); break; case PAUSED: break; case RESUMED: break; case AD_BREAK_READY: // AdEventType.AD_BREAK_READY will be fired when VMAP ads are ready to be played. // For VAMP ads, mMediaVideoAd.start() must be called after AdEventType.AD_BREAK_READY if (mMediaVideoAd != null) { mMediaVideoAd.start(); } break; case ALL_ADS_COMPLETED: if (mMediaVideoAd != null) { mMediaVideoAd.onDestroy(); mMediaVideoAd = null; } mVideoPlayerWithAdPlayback.resumeContentAfterAdPlayback(); mVideoPlayerWithAdPlayback.setReadyToPlayContent(false); break; case AD_BREAK_FETCH_ERROR: // A CONTENT_RESUME_REQUESTED event should follow to trigger content playback. if (mMediaVideoAd != null) { mMediaVideoAd.onDestroy(); mMediaVideoAd = null; } mVideoPlayerWithAdPlayback.resumeContentAfterAdPlayback(); mVideoPlayerWithAdPlayback.setReadyToPlayContent(false); break; default: break; } } } }); if (mMediaVideoAd != null) { if (!mMediaVideoAd.isVMAPOffer()) { //VAST just load start mMediaVideoAd.start(); } else { //VAMP wait OnIMAEventListener#AD_BREAK_READY call } } } ``` -------------------------------- ### Get App List Request and Response Source: https://help.toponad.net/docs/App-API Example request and response for the /v1/apps endpoint to retrieve a list of applications. ```json { "limit":1 } ``` ```json [ { "app_name": "uparputest", "app_id": "a5bc9921f7fdb4", "platform": 2, "market_url": "https://itunes.apple.com/cn/app/%E7%A5%9E%E5%9B%9E%E9%81%BF/id1435756371?mt=8", "category": "Game", "sub_category": "Action", "screen_orientation": 3 } ] ``` -------------------------------- ### Get Adsource Detail Response Source: https://help.toponad.net/docs/Adsource-API-v3 Example JSON response containing a list of Adsource objects with their respective configurations and identifiers. ```json [ { "id": 374133, "placement_id": "b6049c640e6ad1", "network_id": 4779, "name": "CSJ_rv_3", "type": 2, "mix_format": -1, "adsource_token": { "app_id": "5343323", "personalized_template": "1", "slot_id": "4566363563" }, "auto_unit_sw": 2, "nw_firm_id":15 }, { "id": 417018, "placement_id": "b6049c640e6ad1", "network_id": 4779, "name": "CSJ_rv_6", "type": 2, "mix_format": -1, "adsource_token": { "app_id": "5343323", "personalized_template": "0", "slot_id": "324ewrwe" }, "auto_unit_sw": 2, "nw_firm_id":15 } ] ``` -------------------------------- ### TU TURewardVideoAutoAd: initialize with Methods and addPlacementId Source: https://help.toponad.net/docs/Fully-automatic-loading-F6tB TopOn TU variant of the same example, using TURewardVideoAutoAd and TUAdConst.KEY for user ID and custom data. Same two init methods and must include setPlacementIdLocalExtra before init if localExtra info is needed. ```java //--------------------- Method 1 ------------------------- //Pass in the Ad Placement id directly during initialization; one or more ids are supported. String[] placementIdArr = new String[]{"your placementId_1 ", "your placementId_2"}; //If you need to set the server-side callback localExtra info, make sure to do it before TURewardVideoAutoAd.init() setPlacementIdLocalExtra(placementIdArr); TURewardVideoAutoAd.init(activity, placementIdArr, new TURewardVideoAutoLoadListener() { @Override public void onRewardVideoAutoLoaded(String placementId) {} @Override public void onRewardVideoAutoLoadFail(String placementId, AdError adError) {} }); //--------------------- Method 1 ------------------------- //--------------------- Method 2 ------------------------- //Initialize first, then pass in the Ad Placement id; one or more ids supported String[] placementIdArr = new String[]{"your placementId_1 ", "your placementId_2"}; //If you need to set localExtra info, call setPlacementIdLocalExtra before TURewardVideoAutoAd.init() setPlacementIdLocalExtra(placementIdArr); TURewardVideoAutoAd.init(activity, null, new TURewardVideoAutoLoadListener() { @Override public void onRewardVideoAutoLoaded(String placementId) {} @Override public void onRewardVideoAutoLoadFail(String placementId, AdError adError) {} }); TURewardVideoAutoAd.addPlacementId(placementIdArr); //--------------------- Method 2 ------------------------- //Set the server-side callback localExtra info private void setPlacementIdLocalExtra(String... placementIdArr) { for (String placementId : placementIdArr) { String userid = "test_userid_001"; String userdata = "test_userdata_001"; Map localMap = new HashMap<>(); localMap.put(TUAdConst.KEY.USER_ID, userid); localMap.put(TUAdConst.KEY.USER_CUSTOM_DATA, userdata); //Takes effect from the next ad load TURewardVideoAutoAd.setLocalExtra(placementId, localMap); } } ``` -------------------------------- ### Sample response for GET /v3/waterfall/units Source: https://help.toponad.net/docs/Waterfall-API Example JSON response showing the structure of returned data, including id and items array with waterfall properties. ```json [ { "id": 2280206, "items": [ { "mediation_group_id": 273234, "segment_id": 0, "abtest_group_item_id": 0, "ecpm": 2, "ecpm_rank": 1, "remark": "", "setup_sw": 1, "auto_ecpm_switch": 1, "auto_ecpm": 0, "cap_hour": -1, "cap_day": -1, "pacing": -1, "show_delay": 0, "show_delay_rate": 100, "bid_floor": 0 } ] } ] ``` -------------------------------- ### Load banner ad example (Objective-C) Source: https://help.toponad.net/docs/Banner-Ads-A93Q Complete example of loading a banner ad with a placement ID, scene ID, and size. The banner size must match the ratio configured in the backend. The extra dictionary can include ad configuration parameters and custom parameters. ```objc //Import header file #import @interface BannerVC () @property (nonatomic, strong) ATBannerView *bannerView; @property (nonatomic, assign) BOOL hasLoaded; // Ad loading status identifier @end @implementation BannerVC //Ad placement ID #define BannerPlacementID @"b680a1e7874fce" //Scene ID, optional, can be generated in the backend. If not available, pass an empty string #define BannerSceneID @"" //Please note that banner size needs to be consistent with the ratio configured in the backend #define BannerSize CGSizeMake(320, 50) ``` -------------------------------- ### Get USD to CNY exchange rate request Source: https://help.toponad.net/docs/USD-to-CNY-exchange-rate A cURL request example to retrieve the exchange rate for a specific date using authentication headers. ```bash curl --location --request GET 'https://api.toponad.net/v1/exchange_rate/list?date=20250730' \ --header 'X-Up-Key: 877f8ae9c6e9ca82c0===b5fff594c373axxx' \ --header 'X-Up-Signature: CE12B506DBCD868C2C6F09E08C139CBC' \ --header 'X-Up-Timestamp: 1626056011000' \ --header 'Content-Type: application/json' ``` -------------------------------- ### Initialize SDK and enter test tool (ATSDK) Source: https://help.toponad.net/docs/How-to-test-ads Initialize the ATSDK and launch the debugger UI using the SDK debug key. ```java //1. Initialize the SDK ATSDK.init(context, "your app id", "your app key"); //2. Set the Debug Key to enter the test tool ATDebuggerUITest.showDebuggerUI(context, "your debug key"); ``` -------------------------------- ### POST /v1/apps Source: https://help.toponad.net/docs/App-API Get a list of apps. This endpoint retrieves app information, optionally filtered by app IDs or paginated with start and limit parameters. ```APIDOC ## POST /v1/apps ### Description Get a list of apps. This endpoint retrieves app information, optionally filtered by app IDs or paginated with start and limit parameters. ### Method POST ### Endpoint https://api.toponad.net/v1/apps ### Parameters #### Request Body - **app_ids** (Array[String]) - Optional - ["abc", "acc"] (Cannot be used with the following parameters) - **start** (Int) - Optional - Default 0 - **limit** (Int) - Optional - Default 100 , [0, 100] ### Request Example { "limit":1 } ### Response #### Success Response (200) - **app_id** (String) - Required - App ID - **app_name** (String) - Required - App name - **platform** (Int) - Required - Platform 1 or 2 (1: android, 2: iOS) - **market_url** (String) - Optional - - - **screen_orientation** (Int) - Required - 1: Portrait, 2: Landscape, 3: Both - **package_name** (String) - Optional - - - **category** (String) - Optional - - - **sub-category** (String) - Optional - - - **apps.coppa** (String) - Optional - Whether to comply with COPPA protocol. Default: no 1: No 2: Yes - **apps.ccpa** (String) - Optional - Whether to comply with CCPA protocol. Default: no 1: No 2: Yes #### Response Example [ { "app_name": "uparputest", "app_id": "a5bc9921f7fdb4", "platform": 2, "market_url": "https://itunes.apple.com/cn/app/%E7%A5%9E%E5%9B%9E%E9%81%BF/id1435756371?mt=8", "category": "Game", "sub_category": "Action", "screen_orientation": 3 } ] ``` -------------------------------- ### Sample request URL for GET /v3/waterfall/units Source: https://help.toponad.net/docs/Waterfall-API Example URL with query parameters ids and currency. Use this to retrieve waterfall properties for the specified adsource IDs. ```http https://api.toponad.net/v3/waterfall/units?ids=417018,2280206¤cy=CNY ``` -------------------------------- ### Display Rewarded Video Ad with Scenario Source: https://help.toponad.net/docs/Fully-automatic-loading This example demonstrates the workflow for displaying a rewarded video ad: entering a scenario, checking if the ad is ready, and then showing the ad. ```java /* In order to calculate the scene arrival rate, relevant information can be consulted“ https://docs.toponad.com/#/zh -CN/android/NetworkAccess/scenario/scenario“ Call the "Enter Advertising Scene" method when the advertising triggering conditions are met, for example: **If an advertisement pops up after the cleaning is completed, it will be called at the end of the cleaning; *1. First call "entryAdScenario" *2. Can calling "isAdReady" display *3. Finally, call "show" to display *4. Scenario ID is passed in to the backend scene management for data display */ ATRewardVideoAd.entryAdScenario("your rv placementID", "your scenarioID"); //Need to determine if the advertising space is ready if(ATRewardVideoAutoAd.isAdReady("your rv placementID")){ ATRewardVideoAutoAd.show(activity, "your rv placementID", "your scenarioID",autoEventListener); } ``` -------------------------------- ### Get Mediation Segment Response Data Source: https://help.toponad.net/docs/Segment-API Example JSON response containing a list of segment objects with their respective IDs, names, priorities, and rule configurations. ```json { "data": [ { "segment_id": 600270, "segment_name": "sdk_and_brand", "priority": 8, "parallel_request_number": 1, "auto_load": 0, "hour_cap": -1, "day_cap": -1, "pacing": -1, "rules": [ { "type": 9, "rule": 7, "content": "5.2.1" }, { "type": 11, "rule": 1, "content": [ "apple", "acer", "advan" ] } ] }, { "segment_id": 600262, "segment_name": "sdk", "priority": 9, "parallel_request_number": 1, "auto_load": 20, "hour_cap": 2, "day_cap": 3, "pacing": 4, "rules": [ { "type": 9, "rule": 7, "content": "5.2.1" } ] }, { "segment_id": 0, "segment_name": "Default Segment", "priority": 10, "parallel_request_number": 1, "auto_load": 0, "hour_cap": -1, "day_cap": -1, "pacing": -1, "rules": [] } ] } ``` -------------------------------- ### Batch Create and Update Placements - Return Sample Source: https://help.toponad.net/docs/Placement-API JSON response returned after creating a placement. Contains app_name, app_id, platform, placement_id, placement_name, adformat, remark, template, and template_extra. ```json [ { "app_name": "test1", "app_id": "a5c41a9ed1679c", "platform": 2, "placement_id": "b1bv57tielnlts", "placement_name": "6", "adformat": "native", "remark": "remark", "template": 2, "template_extra": { "cdt": 55, "ski_swt": 1, "aut_swt": 1 } } ] ``` -------------------------------- ### Get Adsource Detail Request Source: https://help.toponad.net/docs/Adsource-API-v3 Example cURL request to retrieve details for specific Adsource IDs. Requires authentication headers including X-Up-Key, X-Up-Signature, and X-Up-Timestamp. ```bash curl --location --request GET 'https://api.toponad.net/v3/units?ids=417018,374133' \ --header 'X-Up-Key: 877f8ae9c6e9ca82c0===b5fff594c373axxx' \ --header 'X-Up-Signature: CE12B506DBCD868C2C6F09E08C139CBC' \ --header 'X-Up-Timestamp: 1626056011000' \ --header 'Content-Type: application/json' \ --data-raw '' ``` -------------------------------- ### Initialize SDK and enter test tool (TUSDK) Source: https://help.toponad.net/docs/How-to-test-ads Initialize the TUSDK and launch the debugger UI using the SDK debug key. ```java //1. Initialize the SDK TUSDK.init(context, "your app id", "your app key"); //2. Set the Debug Key to enter the test tool TUDebuggerUITest.showDebuggerUI(context, "your debug key"); ``` -------------------------------- ### Configure Meta (Bidding) Debug Mode Source: https://help.toponad.net/docs/How-to-test-ads General and advanced setup for Meta. Requires Facebook app installed, logged in, and consistent App ID/Placement ID prefix. ```java // General setup TUSDK.setDebuggerConfig(context, GAID, new TUDebuggerConfig.Builder(Facebook_NETWORK).build()); // Advanced usage TUSDK.setDebuggerConfig(context, AndroidID,new TUDebuggerConfig.Builder(Facebook_NETWORK).setNativeType(nativeType).build()); ``` -------------------------------- ### Recommended File Structure Source: https://help.toponad.net/docs/Custom-Base-Adapter The recommended directory structure for the base adapter module. ```text ├── Base/ # Base adapter module │ ├── DemoCustomAdapterCommonHeader.h # Used to declare common header files │ ├── DemoCustomBaseAdapter.h # Base adapter header file │ ├── DemoCustomBaseAdapter.m # Base adapter implementation, defines the initialization adapter class name │ ├── DemoCustomInitAdapter.h # Initialization adapter header file │ └── DemoCustomInitAdapter.m # Initialization adapter implementation ``` -------------------------------- ### Create Apps Return Sample Source: https://help.toponad.net/docs/App-API-v3 The JSON response returned upon a successful app creation, containing the generated app uuid and app_key. ```json { "items": [ { "uuid": "a66cccsxxxx", "app_key": "0b9df85fb9d552ef7====b805e6b004" } ] } ``` -------------------------------- ### GET /v3/mediation_group/:placement_id Source: https://help.toponad.net/docs/Segment-API Retrieves all mediation groups under the specified placement ID. This endpoint returns a list of mediation groups with details such as group ID, name, A/B test group ID, traffic variation, pending status, timezone, and start time. ```APIDOC ## GET /v3/mediation_group/:placement_id ### Description Retrieves all mediation groups under the specified placement ID. ### Method GET ### Endpoint https://api.toponad.net/v3/mediation_group/:placement_id ### Parameters #### Path Parameters - **placement_id** (string) - Required - The placement ID for which to retrieve mediation groups. ### Request Example https://api.toponad.net/v3/mediation_group/b60f6e9480e4ba ### Response #### Success Response (200) - **data** (Object) - Required - Contains the list of mediation groups. - **data.mediation_group_id** (Int) - Required - Mediation Group ID. - **data.mediation_group_name** (String) - Required - A/B test group name. - **data.abtest_group_item_id** (Int) - Required - A/B test group id. - **data.traffic_variation** (Int) - Required - A/B test group weight. - **data.is_pending** (Bool) - Required - Whether a group is to take effect. false: test-in-process, true: Group to Take Effect. - **data.timezone** (Int) - Required - Time zone of the start time. -12~12 = West 12 to East 12. It has a value when it takes effect. - **data.start_time** (Int) - Required - Start time, timestamp. It has a value when it takes effect. #### Response Example { "data": [ { "mediation_group_id": 116112, "mediation_group_name": "A组", "abtest_group_item_id": 10000080, "traffic_variation": 2, "is_pending": false, "time_zone": 0, "start_time": 0 }, { "mediation_group_id": 116113, "mediation_group_name": "B组", "abtest_group_item_id": 10000081, "traffic_variation": 1, "is_pending": false, "time_zone": 0, "start_time": 0 }, { "mediation_group_id": 116114, "mediation_group_name": "C组", "abtest_group_item_id": 10000082, "traffic_variation": 1, "is_pending": false, "time_zone": 0, "start_time": 0 } ] } ``` -------------------------------- ### Recommended ATSDK GDPR Configuration Process Source: https://help.toponad.net/docs/Overseas-privacy-configuration Recommended setup for the EU region to ensure GDPR compliance by showing the consent dialog before SDK initialization. ```java ATSDK.showGDPRConsentDialog(context, new ATGDPRConsentDismissListener() { @Override public void onDismiss(ConsentDismissInfo consentDismissInfo) { ATSDK.init(context, "your app id", "your app key"); } }); ``` -------------------------------- ### Cocos SDK Migration Examples Source: https://help.toponad.net/docs/Cocos-SDK-API-Migration-Guide Provides side-by-side comparisons for initializing the SDK and loading various ad formats including Banner, Interstitial, Native, and Rewarded Video. ```typescript // Initialize SDK // Old import { ATJSSDK } from "./ATJSSDK"; ATJSSDK.initSDK("appId", "appKey"); // New import { ATSDK } from "./ATSDK"; ATSDK.initSDK("appId", "appKey"); // Load Banner Ad // Old import { ATBannerTSSDK } from "./ATBannerTSSDK"; ATBannerTSSDK.loadBanner("placementId", settings); // New import { ATBannerSDK } from "./ATBanner"; ATBannerSDK.loadAd("placementId", settings); // Load Interstitial Ad // Old import { ATIntersitialTSSDK } from "./ATIntersitialTSSDK"; ATIntersitialTSSDK.loadInterstitial("placementId", settings); // New import { ATInterstitialSDK } from "./ATInterstitial"; ATInterstitialSDK.loadAd("placementId", settings); // Load Native Ad // Old import { ATNativeTSSDK } from "./ATNativeTSSDK"; ATNativeTSSDK.loadNative("placementId", settings); // New import { ATNativeSDK } from "./ATNative"; ATNativeSDK.loadAd("placementId", settings); // Load Rewarded Video Ad // Old import { ATRewardedVideoTSSDK } from "./ATRewardedVideoTSSDK"; ATRewardedVideoTSSDK.loadRewardedVideo("placementId", settings); // New import { ATRewardedVideoSDK } from "./ATRewardedVideo"; ATRewardedVideoSDK.loadAd("placementId", settings); ``` -------------------------------- ### Example impression link URL Source: https://help.toponad.net/docs/Click-URL-Configuration-Instructions Example impression link for Adjust: https://app.adjust.com/impression ```text https://app.adjust.com/impression ``` -------------------------------- ### Initialize AnyThinkSDK with optional configurations Source: https://help.toponad.net/docs/Unity-SDK-initialization Use this code to initialize the TopOn SDK in Unity after user consent. It includes optional calls to set custom maps, channel, sub-channel, and debug logging. The initSDK call is required and must use your own app_id and app_key. ```csharp // (Optional configuration) Set custom Map information, which can match the list of ad network orders configured in the dashboard (App dimension) // Note: Calling this method will clear the information set by setChannel() and setSubChannel(). If you have set this information, please re-set it after calling this method. ATSDKAPI.initCustomMap(new Dictionary { { "unity3d_data", "test_data" } }); // (Optional configuration) Set custom Map information, which can match the list of ad network orders configured in the dashboard (Placement dimension) ATSDKAPI.setCustomDataForPlacementID(new Dictionary { { "unity3d_data_pl", "test_data_pl" } } ,placementId); // (Optional configuration) Set the channel information. Developers can use this channel information in the dashboard to differentiate and view each channel's ad data. // Note: If the initCustomMap() method is used, this method must be called after the initCustomMap() method. ATSDKAPI.setChannel("unity3d_test_channel"); // (Optional configuration) Set the sub-channel information. Developers can use this channel information in the dashboard to differentiate and view each channel's sub-channel ad data. // Note: If the initCustomMap() method is used, this method must be called after the initCustomMap() method. ATSDKAPI.setSubChannel("unity3d_test_subchannel"); // Enable Debug log (strongly recommended to enable during the testing phase to help troubleshoot issues) ATSDKAPI.setLogDebug(true); // (Required configuration) Initialize the SDK ATSDKAPI.initSDK("a5c4ad280995c9", "7b4e37f819dbee652ef79c4506e14288");//Use your own app_id & app_key here ``` -------------------------------- ### Start Manual A/B Test Request Source: https://help.toponad.net/docs/A-B-Test The PUT request to manually start an A/B test. ```text https://api.toponad.net/v3/abtest/5810/start_manual ``` -------------------------------- ### Initialize TopOn SDK with ATSDK.initSDK Source: https://help.toponad.net/docs/Integration-BNOC Initializes the TopOn SDK using the ATSDK.initSDK method. Includes commented-out GDPR initialization flow that can be uncommented to handle GDPR consent before initialization. ```typescript import {ATSDK} from "db://assets/script/AnyThinkAds/ATSDK"; // ---------------GDPR Initialization Flow start------------------------------ /*ATSDK.getUserLocation(function (userLocation: string | number) { if (userLocation === ATSDK.kATUserLocationInEU) { if (ATSDK.getGDPRLevel() === ATSDK.UNKNOWN) { ATSDK.showGDPRConsent(function () { ATSDK.initSDK("your app id", "your app key"); }); } } });*/ // ---------------GDPR Initialization Flow end------------------------------ ATSDK.initSDK("your app id", "your app key"); ``` -------------------------------- ### Example of collecting ad frame from activity Source: https://help.toponad.net/docs/tjwNgGMm A practical example of invoking collectFrameFromAdPage with a 3000ms delay. ```java MaterialMonitor.get().collectFrameFromAdPage( InterstitialAdActivity.this, adInfo, timing, new FrameOptions.Builder().delayMs(3000).build(), callback); ``` -------------------------------- ### initSDK Source: https://help.toponad.net/docs/Unity-SDK-initialization Initializes the TopOn Unity SDK with the app ID and app key obtained from the TopOn dashboard. ```APIDOC ## initSDK ### Description Initializes the TopOn Unity SDK. The appId and appKey need to be obtained after creating an app in the TopOn dashboard. ### Method initSDK ### Parameters - **appid** (string) - Required - The application ID obtained from the TopOn dashboard. - **appkey** (string) - Required - The application key obtained from the TopOn dashboard. ### Notes - How to get the App Key? Refer to the TopOn dashboard documentation. ``` -------------------------------- ### ATSplashAd Scenario Statistics and Display Source: https://help.toponad.net/docs/Splash-Ad-wwJ3 Demonstrates the sequence of calling entryAdScenario, checking readiness with isAdReady, and displaying the ad using ATShowConfig for ATSplashAd. ```java ATSplashAd.entryAdScenario("your placement id", "your scenario id"); //6.5.80 and above splashAd.entryAdScenario("your scenario id"); if (splashAd.isAdReady()) { ATShowConfig showConfig = new ATShowConfig.Builder() .scenarioId("your scenario id") .build(); splashAd.show(activity,showConfig); } else { splashAd.load(); } ``` -------------------------------- ### TopOn SDK Initialization and Configuration Source: https://help.toponad.net/docs/Initialization-instructions-3iXm A comprehensive class implementation for configuring SDK settings, managing GDPR consent, and initializing the TopOn SDK. ```dart import 'package:secmtp_sdk/at_index.dart'; import '../configuration_sdk.dart'; final InitManger = InitTool(); class InitTool{ // Enable SDK Debug logs. It is highly recommended to enable this during testing to facilitate troubleshooting. setLogEnabled() async { ATInitManger .setLogEnabled( logEnabled: true, ); } // Set channel, which can be used for data statistics and traffic grouping setChannelStr() async { ATInitManger .setChannelStr( channelStr: "test_setChannel", ); } // Set subchannel, which can be used for data statistics and traffic grouping setSubchannelStr() async { ATInitManger .setSubChannelStr( subchannelStr: "test_setSubchannelStr", ); } // Set custom Map information to match the corresponding traffic grouping configured in the backend (App level) (optional configuration) setCustomDataDic() async { ATInitManger.setCustomDataMap( customDataMap: { 'setCustomDataDic': 'myCustomDataDic', }, ); } // Set excluded cross-promotion App list setExludeBundleIDArray() async { ATInitManger.setExludeBundleIDArray( exludeBundleIDList: ['test_setExludeBundleIDArray'], ); } // Set custom Map information to match the corresponding traffic grouping configured in the backend (Placement level) (optional configuration) setPlacementCustomData() async { ATInitManger.setPlacementCustomData( placementIDStr: 'b5b72b21184aa8', placementCustomDataMap: {'setPlacementCustomData': 'test_setPlacementCustomData'}, ); } // Determine if the user is located in the EU region getUserLocation() async { ATInitManger.getUserLocation().then((value) { print('flutter: Get user location -- ${value.toString()}'); }); } // Get GDPR authorization level getGDPRLevel() async { await ATInitManger.getGDPRLevel().then((value) { print('flutter:Get GDPR --${value.toString()}'); }); } setDataConsentSet() async { ATInitManger.setDataConsentSet( gdprLevel: ATInitManger.dataConsentSetPersonalized()); } deniedUploadDeviceInfo() async { ATInitManger .deniedUploadDeviceInfo( deniedUploadDeviceInfoList: [ATInitManger.aOAID()]); } // Initialize TopOn SDK initTopon() async { await ATInitManger.initSDK( appidStr: Configuration.appidStr, appidkeyStr: Configuration.appidkeyStr); } // Display GDPR authorization interface (deprecated in v6.2.87, use showGDPRConsentDialog() instead) showGDPRAuth()async{ ATInitManger.showGDPRAuth(); } // v6.2.87+, Display the GDPR interface (UMP), Flutter SDK v1.0.15+ now includes an optional parameter called appId showGDPRConsentDialog()async{ ATInitManger.showGDPRConsentDialog( appId: 'your appid', ); } // v6.5.73+,FFlutter SDK v1.0.15+, presenting the secondary authorization interface (UMP) for GDPR compliance showGDPRConsentDialog()async{ ATInitManger.showGDPRConsentSecondDialog( appId: 'your appid', ); } // Get GDPR listener event callbacks initListen() { ATListenerManager.initEventHandler.listen((value) { if (value.userLocation != null) { switch (value.userLocation) { case InitUserLocation.initUserLocationInEU: print("flutter Monitor initial user location in the EU--"); ATInitManger.getGDPRLevel().then((value) { if (value == ATInitManger.dataConsentSetUnknown()) { showGDPRAuth(); } }); break; case InitUserLocation.initUserLocationOutOfEU: print("flutter: flutter The location of the listening initial user is not in the EU"); break; case InitUserLocation.initUserLocationUnknown: print("flutter: flutter The location of the initial listening user is unknown"); break; } } if (value.consentDismiss != null) { print("flutter: flutter consent dismiss callback"); } }); } } ```