How to pass predefined custom targeting values in ad request (Only for GAM)

1

Create AdRequestConfiguration

Java

Java
AdRequestConfiguration.Builder configuration = AdRequestConfiguration.Companion.builder(context, "Your_placement_name");

Kotlin

Kotlin
val configuration = AdRequestConfiguration.builder(context, "Your_placement_name")
2

Add predefined ad targeting parameters to the AdRequest

  • Single key with single value Link: https://docs.adster.tech/feature-only-for-gam/how-to-pass-predefined-custom-targeting-values-in-ad-request-only-for-gam#single-key-with-single-value

Java / Kotlin
configuration.addCustomTargetingValue("YOUR_KEY","YOUR_VALUE");
3

Cleanup

Call MediationBannerAd.destroy() when the activity/fragment is destroyed or detached.

Links:

  • Previous: https://docs.adster.tech/feature-only-for-gam/render-unified-ad-only-for-gam

  • Next: https://docs.adster.tech/feature-only-for-gam/how-to-pass-publisher-provided-identifiers-in-ad-request-ppid-only-for-gam

Last updated 13 days ago

Privacy policy: https://adster.tech/pp