Reference
Configuration and inputs
What you hand the SDK. NGAConfig and NGAConsent at initialize, and NGAAdRevenue for other networks' revenue.
NGAConfig #
Holds what initialize needs: the app key, the starting consent and test mode. Everything else (placements, caps, networking) comes from NGA's server.
Unity (C#)
new NGAConfig.Builder(string appKey, NGAConsent consent)
.TestMode(bool enabled) // optional; default false
.Build() // -> NGAConfig
Android (Kotlin)
NGAConfig.Builder(appKey: String, consent: NGAConsent)
.testMode(enabled: Boolean) // optional; default false
.build() // -> NGAConfig
Android (Java)
new NGAConfig.Builder(String appKey, NGAConsent consent)
.testMode(boolean enabled) // optional; default false
.build(); // -> NGAConfig
iOS (Swift)
NGAConfig.Builder(appKey: String, consent: NGAConsent)
.testMode(_ enabled: Bool) // optional; default false
.build() // -> NGAConfig
iOS (Objective-C)
[[[NGAConfigBuilder alloc] initWithAppKey:(NSString *)appKey consent:(NGAConsent *)consent]
testMode:(BOOL)enabled] // optional; default NO
build] // -> NGAConfig *
| Name | Required | Description |
|---|---|---|
appKey |
yes | app_ and 8 to 64 letters or digits, the game's key from the portal; the same on Android and iOS |
consent |
yes | the player's consent as you last stored it, or NGAConsent.unknown(). How it combines with setConsent: Consent |
testMode |
no; default false | marks this install's traffic as test. A registered test device does the same; see Test mode |
- Errors: the builder validates nothing;
initializedoes, and fails withINVALID_CONFIG / app_key.formatfor a malformed key. - Notes: in C#, a built
NGAConfigalso reads back what it holds:AppKey,ConsentandTestModeEnabled.
NGAConsent #
The player's consent: two fields, each an NGAConsentState.
Unity (C#)
public sealed class NGAConsent : IEquatable<NGAConsent>
{
public NGAConsent(NGAConsentState analytics, NGAConsentState adsPersonalization)
public NGAConsentState Analytics { get; }
public NGAConsentState AdsPersonalization { get; }
public static NGAConsent Unknown()
}
Android (Kotlin)
class NGAConsent(val analytics: NGAConsentState, val adsPersonalization: NGAConsentState) {
companion object { @JvmStatic fun unknown(): NGAConsent }
}
Android (Java)
public NGAConsent(NGAConsentState analytics, NGAConsentState adsPersonalization)
public NGAConsentState getAnalytics()
public NGAConsentState getAdsPersonalization()
public static NGAConsent unknown()
iOS (Swift)
final class NGAConsent: NSObject {
init(analytics: NGAConsentState, adsPersonalization: NGAConsentState)
let analytics: NGAConsentState
let adsPersonalization: NGAConsentState
static func unknown() -> NGAConsent
}
iOS (Objective-C)
- (instancetype)initWithAnalytics:(NGAConsentState)analytics adsPersonalization:(NGAConsentState)adsPersonalization;
@property (readonly) NGAConsentState analytics;
@property (readonly) NGAConsentState adsPersonalization;
+ (NGAConsent *)unknown;
| Name | Required | Description |
|---|---|---|
analytics |
yes | the SDK's collection for your game; what it covers is on Consent |
adsPersonalization |
yes | NGA's own use of the player's data across games; what it covers is on Consent |
- Notes:
unknown()is both fieldsUNKNOWN: "not answered yet". TwoNGAConsentvalues with the same fields are equal. HowUNKNOWNresolves by region, and how the IAB keys combine with your answer: Consent.
NGAAdRevenue #
One impression's revenue from another network, for logAdRevenue.
Unity (C#)
new NGAAdRevenue.Builder(NGAAdRevenueMediation mediation, long revenueMicros, string currency, NGARevenuePrecision precision)
.Network(string network)
.AdUnitId(string adUnitId)
.AdFormat(NGAAdFormat adFormat)
.Placement(string placement)
.NetworkPlacement(string networkPlacement)
.CreativeId(string creativeId)
.AdvertiserDomain(string advertiserDomain)
.ImpressionId(string impressionId)
.Build() // -> NGAAdRevenue
Android (Kotlin)
NGAAdRevenue.Builder(mediation: NGAAdRevenueMediation, revenueMicros: Long, currency: String, precision: NGARevenuePrecision)
.network(name: String)
.adUnitId(id: String)
.adFormat(format: NGAAdFormat)
.placement(name: String)
.networkPlacement(id: String)
.creativeId(id: String)
.advertiserDomain(adomain: String)
.impressionId(id: String)
.build() // -> NGAAdRevenue
Android (Java)
new NGAAdRevenue.Builder(NGAAdRevenueMediation mediation, long revenueMicros, String currency, NGARevenuePrecision precision)
.network(String name)
.adUnitId(String id)
.adFormat(NGAAdFormat format)
.placement(String name)
.networkPlacement(String id)
.creativeId(String id)
.advertiserDomain(String adomain)
.impressionId(String id)
.build(); // -> NGAAdRevenue
iOS (Swift)
NGAAdRevenue.Builder(mediation: NGAAdRevenueMediation, revenueMicros: Int64, currency: String, precision: NGARevenuePrecision)
.network(_ name: String)
.adUnitId(_ id: String)
.adFormat(_ format: NGAAdFormat)
.placement(_ name: String)
.networkPlacement(_ id: String)
.creativeId(_ id: String)
.advertiserDomain(_ adomain: String)
.impressionId(_ id: String)
.build() // -> NGAAdRevenue
iOS (Objective-C)
[[[NGAAdRevenueBuilder alloc] initWithMediation:(NGAAdRevenueMediation)mediation
revenueMicros:(int64_t)revenueMicros
currency:(NSString *)currency
precision:(NGARevenuePrecision)precision]
network:(NSString *)name] // and adUnitId:, adFormat:, placement:, networkPlacement:,
build] // creativeId:, advertiserDomain:, impressionId: -> NGAAdRevenue *
| Name | Required | Description |
|---|---|---|
mediation |
yes | the layer that served the ad: ADMOB, MAX, LEVELPLAY, OTHER, or NONE for one network with no mediation |
revenueMicros |
yes | the revenue in micros, 0 or more; convert a decimal once by rounding: (revenue * 1_000_000).roundToLong(). Otherwise INVALID_ARGUMENT / ad_revenue.revenue |
currency |
yes | three letters, sent upper-case. Otherwise INVALID_ARGUMENT / ad_revenue.currency |
precision |
yes | NGARevenuePrecision, as your network reports it |
network |
no | the network that served the ad |
adUnitId |
no | the ad unit in your mediation's dashboard |
adFormat |
no | NGAAdFormat |
placement |
no | your own name for the spot in the game |
networkPlacement |
no | the serving network's own placement id |
creativeId |
no | the creative's id |
advertiserDomain |
no | the advertiser's domain |
impressionId |
no | the impression id your mediation assigned |
- Errors: each string is at most 200 characters; otherwise
INVALID_ARGUMENT / ad_revenue.length. The builder validates nothing;logAdRevenuedoes. - Notes: in C#, a built
NGAAdRevenuereads back each field as a property of the same name:Mediation,RevenueMicros,Currency,Precision,Network,AdUnitId,AdFormat,Placement,NetworkPlacement,CreativeId,AdvertiserDomainandImpressionId.