| API | Parameters | Description |
|---|---|---|
| initSDK | string appid, string appkey | Initialize the SDK. The appId and appKey need to be obtained after creating an app in the TopOn dashboard. How to get the App Key? |
| setLogDebug | bool isDebug | Whether to enable the SDK's Debug log. It is strongly recommended to enable it during the testing phase to help troubleshoot issues. |
| setChannel | string channel | Set the channel information, used in the TopOn dashboard to differentiate ad data. Only characters matching the rule A-Za-z0-9\_ are allowed. Note: If the initCustomMap() method is used, this method must be called after the initCustomMap() method. |
| setSubChannel | string subChannel | Set the sub-channel information. Only characters matching the rule A-Za-z0-9\_ are allowed. Note: If the initCustomMap() method is used, this method must be called after the initCustomMap() method. |
| initCustomMap | Dictionary | Custom key-value pairs, which can be used at the App dimension to match the ad list information delivered by the backend. The App's custom rule is a global setting and applies to all placements. Developers can set corresponding custom rules in the traffic groups of the TopOn dashboard. Refer to Traffic Group Usage Instructions for details. 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. |
| setCustomDataForPlacementID | Dictionary | Custom key-value pairs, which can be used at the placement dimension to match the ad list information delivered by the backend. Only effective for the current placement. You can add placement-specific custom rules on top of the App's custom rules. Developers can set corresponding custom rules in the traffic groups of the TopOn dashboard. Refer to Traffic Group Usage Instructions for details. |
| getUserLocation | ATGetUserLocationListener listener | Determine whether the current network is in the EU region. |
| getGDPRLevel | - | Get the current privacy data reporting level. |
| showGDPRAuth | - | Show the GDPR authorization page. Note: Deprecated starting from v6.2.87. Please use showGDPRConsentDialog instead. |
| showGDPRConsentDialog | (Added in v6.2.87) Show the Google UMP GDPR authorization page. |
Your app needs to establish a Privacy Policy, and display the Privacy Policy to the user when the app is first launched and obtain their consent. For the app's Privacy Policy, please refer to the Privacy Compliance Guide. Please be sure to initialize the TopOn SDK only after the user has agreed to the app's Privacy Policy.
You can initialize the AnyThinkSDK using the following code. Refer to the Demo Project for details:
// (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
After initialization is complete, you can start the integration of each ad format:
Rewarded Video Ad Integration
Interstitial Ad Integration
Banner Ad Integration
Native Ad Integration
Splash Ad Integration