SDK docs 0.1.0 preview
ContentsConfiguration and inputs
0.1.0 preview. You install 0.1.0 from Maven Central and NGA's public repositories. Every 0.x version is a preview under the NGA SDK License, and the API can change until 1.0. Questions: hi@nga.network.

Reference

Configuration and inputs

View as Markdown

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; initialize does, and fails with INVALID_CONFIG / app_key.format for a malformed key.
  • Notes: in C#, a built NGAConfig also reads back what it holds: AppKey, Consent and TestModeEnabled.

NGAConsent #

The player's consent: two fields, each an NGAConsentState.

Unity (C#)

Android (Kotlin)

Android (Java)

iOS (Swift)

iOS (Objective-C)

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 fields UNKNOWN: "not answered yet". Two NGAConsent values with the same fields are equal. How UNKNOWN resolves 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; logAdRevenue does.
  • Notes: in C#, a built NGAAdRevenue reads back each field as a property of the same name: Mediation, RevenueMicros, Currency, Precision, Network, AdUnitId, AdFormat, Placement, NetworkPlacement, CreativeId, AdvertiserDomain and ImpressionId.