# Configuration and inputs What you hand the SDK. NGAConfig and NGAConsent at initialize, and NGAAdRevenue for other networks' revenue. *NGA SDK 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. This page: https://nga.io/docs/sdk/reference/configuration/* ## `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#)** ```csharp new NGAConfig.Builder(string appKey, NGAConsent consent) .TestMode(bool enabled) // optional; default false .Build() // -> NGAConfig ``` **Android (Kotlin)** ```kotlin NGAConfig.Builder(appKey: String, consent: NGAConsent) .testMode(enabled: Boolean) // optional; default false .build() // -> NGAConfig ``` **Android (Java)** ```java new NGAConfig.Builder(String appKey, NGAConsent consent) .testMode(boolean enabled) // optional; default false .build(); // -> NGAConfig ``` **iOS (Swift)** ```swift NGAConfig.Builder(appKey: String, consent: NGAConsent) .testMode(_ enabled: Bool) // optional; default false .build() // -> NGAConfig ``` **iOS (Objective-C)** ```objectivec [[[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](https://nga.io/docs/sdk/privacy/#consent) | | `testMode` | no; default false | marks this install's traffic as test. A registered test device does the same; see [Test mode](https://nga.io/docs/sdk/testing/#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`](https://nga.io/docs/sdk/reference/enums/#ngaconsentstate). **Unity (C#)** ```csharp public sealed class NGAConsent : IEquatable { public NGAConsent(NGAConsentState analytics, NGAConsentState adsPersonalization) public NGAConsentState Analytics { get; } public NGAConsentState AdsPersonalization { get; } public static NGAConsent Unknown() } ``` **Android (Kotlin)** ```kotlin class NGAConsent(val analytics: NGAConsentState, val adsPersonalization: NGAConsentState) { companion object { @JvmStatic fun unknown(): NGAConsent } } ``` **Android (Java)** ```java public NGAConsent(NGAConsentState analytics, NGAConsentState adsPersonalization) public NGAConsentState getAnalytics() public NGAConsentState getAdsPersonalization() public static NGAConsent unknown() ``` **iOS (Swift)** ```swift final class NGAConsent: NSObject { init(analytics: NGAConsentState, adsPersonalization: NGAConsentState) let analytics: NGAConsentState let adsPersonalization: NGAConsentState static func unknown() -> NGAConsent } ``` **iOS (Objective-C)** ```objectivec - (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](https://nga.io/docs/sdk/privacy/#consent) | | `adsPersonalization` | yes | NGA's own use of the player's data across games; what it covers is on [Consent](https://nga.io/docs/sdk/privacy/#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](https://nga.io/docs/sdk/privacy/#consent). ## `NGAAdRevenue` One impression's revenue from another network, for [`logAdRevenue`](https://nga.io/docs/sdk/reference/ngasdk/#logadrevenue). **Unity (C#)** ```csharp 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)** ```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)** ```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)** ```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)** ```objectivec [[[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`](https://nga.io/docs/sdk/reference/enums/#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`](https://nga.io/docs/sdk/reference/enums/#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`.