Skip to main content

Ad Parameters

AdParam

The AdParam class is an object that contains various information required for ad requests, including the Ad Unit ID which is essential for ad requests, as well as various information for ad targeting.

You can create objects through AdParam.Builder, and an example of creation is shown below.

val adParam = AdParam.Builder()
.setAdUnitId("AOS_TEST_BANNER") // Ad Unit ID
.setCurrentPageUrl("https://www.naver.com") // Description link for the current page
.setRefererPageUrl("https://www.naver.com") // Referer information
.addCustomParam("channelId", "41312") // Targeting settings and report support through NAM Admin
.build()

Key Methods of AdParam.Builder

setAdUnitId()

Sets the Ad Unit ID. This is a required value that must be set when requesting ads.

val adParam = AdParam.Builder()
.setAdUnitId("AOS_TEST_BANNER")
.build()

addCustomParam()

Adds user-defined parameters for targeting purposes. Key and value need to be verified and agreed upon through NAM administrators.

val adParam = AdParam.Builder()
.setAdUnitId("AOS_TEST_BANNER")
.addCustomParam("channelId", "41312")
.addCustomParam("category", "sports|news") // Multiple values separated by | symbol
.build()

setCustomParam()

Sets user-defined parameters for targeting purposes. Can be used when adding multiple user-defined parameters.

val customParams = mapOf(
"channelId" to "41312",
"category" to "sports",
"age" to "25"
)

val adParam = AdParam.Builder()
.setAdUnitId("AOS_TEST_BANNER")
.setCustomParam(customParams)
.build()

setCurrentPageUrl()

Sets the current page URL for targeting purposes.

val adParam = AdParam.Builder()
.setAdUnitId("AOS_TEST_BANNER")
.setCurrentPageUrl("https://www.example.com/current-page")
.build()

setRefererPageUrl()

Sets the referer page URL for targeting purposes.

val adParam = AdParam.Builder()
.setAdUnitId("AOS_TEST_BANNER")
.setRefererPageUrl("https://www.example.com/referer-page")
.build()

Global SDK Settings

In addition to AdParam which is set for each ad request, you can set common configurations through SdkProperties for SDK-related settings and UserProperties for user-related settings used in targeting.

SdkProperties

An object that manages global SDK settings, including ad request timeout, mute settings, ad provider options, etc.

You can create objects through SdkPropertiesBuilder, and an example of creation is shown below.

GfpSdk.setSdkProperties(GfpSdk.getSdkProperties().buildUpon()
.addProviderOptions(DfpProviderOptions.Builder().setTestMode(false).build())
.addProviderOptions(FanProviderOptions.Builder().setTestMode(false).build())
.addProviderOptions(UnityProviderOptions.Builder().setTestMode(false).build())
.bannerAdRequestTimeout(60_000L)
.unifiedAdRequestTimeout(60_000L)
.videoAdRequestTimeout(60_000L)
.interstitialAdRequestTimeout(60_000L)
.rewardedAdRequestTimeout(60_000L)
.muteAudio(true)
.theme(ResolvedTheme.SYSTEM)
.build())

Key Methods of SdkPropertiesBuilder

addProviderOptions()

For some ad providers, you can set separate feature configurations provided by each ad provider.

GfpSdk.setSdkProperties(GfpSdk.getSdkProperties().buildUpon()
.addProviderOptions(DfpProviderOptions.Builder().setTestMode(false).build())
.addProviderOptions(FanProviderOptions.Builder().setTestMode(false).build())
.addProviderOptions(UnityProviderOptions.Builder().setTestMode(false).build())
.build()
)
info

DfpProviderOptions, FanProviderOptions, UnityProviderOptions provide TestMode settings, and if these ProviderOptions are not set, they will be set to the default value of TestMode, which is false.

bannerAdRequestTimeout()

Sets the request timeout (in milliseconds) for banner ads loaded through GfpBannerAdView. The default value is 60_000 milliseconds.

GfpSdk.setSdkProperties(GfpSdk.getSdkProperties().buildUpon()
.bannerAdRequestTimeout(30_000L) // Set to 30 seconds
.build())

unifiedAdRequestTimeout()

Sets the request timeout (in milliseconds) for ads loaded through GfpAdLoader. The default value is 60_000 milliseconds.

GfpSdk.setSdkProperties(GfpSdk.getSdkProperties().buildUpon()
.unifiedAdRequestTimeout(45_000L) // Set to 45 seconds
.build())

rewardedAdRequestTimeout()

Sets the request timeout (in milliseconds) for rewarded ads loaded through GfpRewardedAdManager. The default value is 60_000 milliseconds.

GfpSdk.setSdkProperties(GfpSdk.getSdkProperties().buildUpon()
.rewardedAdRequestTimeout(90_000L) // Set to 90 seconds
.build())

interstitialAdRequestTimeout()

Sets the request timeout (in milliseconds) for interstitial ads loaded through GfpInterstitialAdManager. The default value is 60_000 milliseconds.

GfpSdk.setSdkProperties(GfpSdk.getSdkProperties().buildUpon()
.interstitialAdRequestTimeout(75_000L) // Set to 75 seconds
.build())

muteAudio()

Sets whether to mute S2S and some C2S video ads, excluding instream video ads. The default value is true.

GfpSdk.setSdkProperties(GfpSdk.getSdkProperties().buildUpon()
.muteAudio(false) // Unmute
.build())

theme()

Sets the GfpTheme value applied to specific ads. The default value is ResolvedTheme.LIGHT.

GfpSdk.setSdkProperties(GfpSdk.getSdkProperties().buildUpon()
.theme(ResolvedTheme.DARK) // Set dark theme
.build())

UserProperties

An object that manages user-related information, including user's gender, birth year, country, language, user ID, etc. These values are used for targeting during ad requests.

You can create objects through UserPropertiesBuilder, and an example of creation is shown below.

GfpSdk.setUserProperties(GfpSdk.getUserProperties().buildUpon()
.yob(1987)
.country("KR")
.language("KO")
.gender(GenderType.MALE)
.addCustomParam("aaa", "bbb")
.setCustomParam(mapOf("k1" to "v1", "k2" to "v2"))
.setContentId("test content")
.build())

Key Methods of UserPropertiesBuilder

gender()

Sets the user's gender. The default value is null.

GfpSdk.setUserProperties(GfpSdk.getUserProperties().buildUpon()
.gender(GenderType.MALE) // or GenderType.FEMALE
.build())

yob()

Sets the user's birth year. The default value is null.

GfpSdk.setUserProperties(GfpSdk.getUserProperties().buildUpon()
.yob(1990) // Set birth year
.build())

country()

Sets the user's country. The default value is null. This is a value for passing to DSP when needed, and is generally not used.

GfpSdk.setUserProperties(GfpSdk.getUserProperties().buildUpon()
.country("KR") // ISO 3166-1 alpha-2 code
.build())

language()

Sets the user's language. Uses a separately set language value, not the language value set on the device. The default value is null, and please enter it as an ISO 639-1 code character.

GfpSdk.setUserProperties(GfpSdk.getUserProperties().buildUpon()
.language("KO") // ISO 639-1 code
.build())

id()

Sets a user identifier for SDK log tracking.

GfpSdk.setUserProperties(GfpSdk.getUserProperties().buildUpon()
.id("user123456") // User identifier
.build())

addCustomParam() / setCustomParam()

Globally used user-defined parameters (from 6.0.0).

info

UserProperties.customParameter added from NAM SDK 6.0.0 is a globally used user-defined parameter that can be merged with AdParam.customParameter used for each ad request.

// Add individual parameters
GfpSdk.setUserProperties(GfpSdk.getUserProperties().buildUpon()
.addCustomParam("userLevel", "premium")
.addCustomParam("interests", "sports|music")
.build())

// Set multiple parameters at once
val customParams = mapOf(
"userLevel" to "premium",
"interests" to "sports|music"
)
GfpSdk.setUserProperties(GfpSdk.getUserProperties().buildUpon()
.setCustomParam(customParams)
.build())

childDirectedTreatment()

Indicates whether the page or app is a child-directed service according to the Children's Online Privacy Protection Act (COPPA). (from 6.1.0) You don't need to set this if it's not necessary or unknown.

GfpSdk.setUserProperties(GfpSdk.getUserProperties().buildUpon()
.childDirectedTreatment(true) // If it's a child-directed service
.build())

underAgeOfConsent()

Indicates whether the ad request is for a user who is not an adult. (from 6.1.0) You don't need to set this if it's not necessary or unknown.

GfpSdk.setUserProperties(GfpSdk.getUserProperties().buildUpon()
.underAgeOfConsent(true) // If the user is not an adult
.build())

setContentId()

Sets the Content ID provided by the Naver API. (from 7.6.2) Please consult with NAM personnel before using if needed.

GfpSdk.setUserProperties(GfpSdk.getUserProperties().buildUpon()
.setContentId("YOUR_CONTENT_ID")
.build())

Resetting SdkProperties and UserProperties

From NAM SDK version 8.4.0, methods to reset SdkProperties and UserProperties have been added. When a logged-in user logs out to initialize user information, or when SDK-related settings need to be initialized, you can handle it as follows.

GfpSdk.resetSdkProperties()
GfpSdk.resetUserProperties()