Integration
For SDK v1.0.0 (beta), follow your AdScope integration guide for credentials, environment (staging vs production), and when to refresh configuration. The patterns below are typical; exact steps may vary by account.
1. Load configuration (recommended)
Register credentials issued by AdScope, then fetch configuration:
using System.Threading.Tasks;
using AdScope;
AdScopeAPI.Configure(new AdScopeClientConfiguration
{
AppId = "YOUR_APP_ID",
ApiKey = "YOUR_API_KEY",
// Optional: BaseUrl, timeout — see API reference / package docs if your integration uses non-default endpoints
});
var result = await AdScopeAPI.FetchConfigurationAsync();
if (!result.Success)
UnityEngine.Debug.LogError(result.ErrorMessage);
Call at the app launch/session start.
If you apply JSON yourself
Some integrations receive configuration through another channel. Use SetConfigFromJson with JSON strings described by your AdScope account manager. This method is only used for particular use cases which can be discussed with your AdScope account manager.
2. Report revenue when an ad fills
Subscribe to your mediation SDK’s revenue / impression / paid callbacks and call AdScopeAPI.ReportAdFilled(revenue, adFormat) with:
revenuein the same currency units your AdScope integration expects (usually USD as adouble).adFormatmapped from the placement or ad format your SDK reports (Banner, MREC, Interstitial, Rewarded, App Open).
Map placements to AdFormat consistently with your AdScope setup. Call on the thread your ad SDK requires (often the Unity main thread).
Patterns below are aligned with each vendor’s Unity documentation—confirm API names, threading, and SDK version in the latest guides. Map ad units / placements to AdFormat in one place in your app.
AppLovin MAX
MAX exposes impression-level user revenue via OnAdRevenuePaidEvent on MaxSdkCallbacks for each format you use. Subscribe after SDK init. Revenue is MaxSdk.AdInfo.Revenue; optional RevenuePrecision describes how the value was produced.
MaxSdkCallbacks.Interstitial.OnAdRevenuePaidEvent += OnAdRevenuePaidEvent;
MaxSdkCallbacks.Rewarded.OnAdRevenuePaidEvent += OnAdRevenuePaidEvent;
MaxSdkCallbacks.Banner.OnAdRevenuePaidEvent += OnAdRevenuePaidEvent;
MaxSdkCallbacks.MRec.OnAdRevenuePaidEvent += OnAdRevenuePaidEvent;
// App Open when supported: MaxSdkCallbacks.AppOpen.OnAdRevenuePaidEvent += ...;
private void OnAdRevenuePaidEvent(string adUnitId, MaxSdk.AdInfo adInfo)
{
double revenue = adInfo.Revenue;
var format = MapMaxAdUnitToAdFormat(adUnitId, adInfo);
AdScopeAPI.ReportAdFilled(revenue, format);
}
Unity LevelPlay (ironSource)
Use LevelPlay Impression Level Revenue: IronSourceEvents.onImpressionDataReadyEvent, with IronSourceImpressionData (e.g. revenue as double?). Register this listener before initializing the LevelPlay SDK. The SDK may fire on a background thread—marshal to the main thread if required by your stack.
- Documentation: Impression-level revenue integration for Unity
// Before LevelPlay SDK initialization:
IronSourceEvents.onImpressionDataReadyEvent += ImpressionDataReadyEvent;
private void ImpressionDataReadyEvent(IronSourceImpressionData impressionData)
{
if (impressionData == null || !impressionData.revenue.HasValue) return;
double revenue = impressionData.revenue.Value;
var format = MapLevelPlayImpressionToAdFormat(impressionData);
AdScopeAPI.ReportAdFilled(revenue, format);
}
Google Mobile Ads (AdMob) — Unity plugin
Each loaded ad object exposes OnAdPaid with AdValue. Per Google, AdValue.Value is in micro-units of the currency (see Google’s AdValue table). Convert to a double in line with your AdScope contract (often USD). Subscribe OnAdPaid as soon as you have the ad instance, before show. See Google’s guidance on main-thread behavior and ILR accuracy.
- Documentation: Impression-level ad revenue (Unity)
// Example: rewarded ad — attach when you have the RewardedAd instance
// rewardedAd.OnAdPaid += HandleRewardedAdPaid;
private void HandleRewardedAdPaid(AdValue adValue)
{
long valueMicros = adValue.Value;
double revenueUsd = valueMicros / 1_000_000.0; // when using USD; verify AdValue.CurrencyCode
AdScopeAPI.ReportAdFilled(revenueUsd, AdFormat.Rewarded);
}
Repeat the same OnAdPaid pattern for BannerView, InterstitialAd, RewardedInterstitialAd, etc., with the correct AdFormat.
Digital Turbine FairBid
FairBid provides ImpressionData on show callbacks—for example InterstitialListener.OnShow(string placementId, ImpressionData impressionData). Use netPayout and currency per FairBid’s reference; Unity examples expose netPayout as a string—parse safely before ReportAdFilled.
- Documentation: Impression Level Data (Unity)
Interstitial.SetInterstitialListener(new MyInterstitialListener());
class MyInterstitialListener : InterstitialListener
{
public void OnShow(string placementId, ImpressionData impressionData)
{
if (impressionData == null) return;
if (!double.TryParse(impressionData.netPayout, System.Globalization.NumberStyles.Any,
System.Globalization.CultureInfo.InvariantCulture, out double revenue))
return;
var format = MapFairBidPlacementToAdFormat(placementId, impressionData);
AdScopeAPI.ReportAdFilled(revenue, format);
}
}
Use the Rewarded and Banner listeners with the same ImpressionData pattern—see FairBid’s Unity tabs per format.
Other networks
| Stack | Official documentation (starting point) |
|---|---|
| Meta Audience Network | Audience Network — Unity |
| Unity Ads | Unity Ads / Grow |
| Custom waterfall | Per-network SDK docs for revenue or CPM callbacks |
When you mediate through MAX, LevelPlay, or AdMob mediation, prefer that platform’s unified revenue callback so you receive one impression value from the mediator.
3. Report no-fill when appropriate
When your app logic determines a request did not fill:
AdScopeAPI.ReportAdNotFilled(AdFormat.Rewarded);
How no-fill affects subsequent key-values is defined by AdScope-managed configuration, which may vary in behaviour to fit your inventory behaviour.
4. Attach key-value to ad requests
Before your ad request:
string kvRewarded = AdScopeAPI.GetKeyValueForFormat(AdFormat.Rewarded);
Aliases: GetTargetingKeyValue(), GetTargetingKeyValueForFormat(format).
5. Optional: initial values
If AdScope directs you to seed values:
AdScopeAPI.SetInitialValues(new InitialValuePayload
{
// Provided by your AdScope Solutions Engineer
});
See API reference for payload options.
6. Optional: context overrides
AdScopeAPI.SetCountry("US");
AdScopeAPI.SetConsent(true);
AdScopeAPI.SetIdfaOptIn(true);
Use only as described in your AdScope materials.
Threading
Prefer the main thread unless your stack says otherwise. Use your preferred async pattern with FetchConfigurationAsync (async/await, coroutines, etc.).
Checklist
- Configuration loaded per AdScope instructions
- Filled and not-filled paths wired as your product requires
- Key-value attached to ad requests per your ad stack
- Unity and package versions meet AdScope requirements