Skip to main content

Overview

Through targeting settings, you can display customized ads to specific user groups. The Adrop SDK provides two targeting methods:
  • Audience Targeting: Display ads based on user properties.
  • Context Targeting: Display ads based on content context (category, topic, etc.).
To collect targeting data, UID and properties must be set before loading ads.

UID Setting

Set a user identifier (UID) to distinguish users. UID is the foundation for targeted advertising.

Usage

import io.adrop.ads.Adrop

// After user login
Adrop.setUID("user_123")

// On user logout
Adrop.setUID("")

Parameters

ParameterTypeDescription
uidStringUser unique identifier (e.g., service member ID)
UID is hashed with SHA-256 before transmission. Do not pass personal information (email, phone number, etc.) directly.
Pass an empty string ("") on logout to reset the UID.

Audience Targeting

Collect user property information to display ads to specific user groups.

Setting Properties

Use the AdropMetrics.setProperty() method to collect user property information.
import io.adrop.ads.metrics.AdropMetrics

// String property
AdropMetrics.setProperty("membership_level", "premium")

// Numeric property
AdropMetrics.setProperty("booking_count", 15)

// Boolean property
AdropMetrics.setProperty("is_subscriber", true)

// Pass null (remove property)
AdropMetrics.setProperty("membership_level", null)

Parameters

ParameterTypeDescription
keyStringProperty key (max 64 characters)
valueAny?Property value (String, Int, Double, Long, Boolean, null)
  • Property key is limited to 64 characters maximum.
  • String values are limited to 256 characters maximum.
  • Numeric values are limited to 9007199254740991 maximum.
  • Up to 256 properties can be set.

Default Properties

The Adrop SDK provides default properties for targeting. Use the AdropKey and AdropValue classes to set values.

Age (Birthday)

When birthday information is provided, age is automatically calculated.
import io.adrop.ads.metrics.AdropMetrics
import io.adrop.ads.model.AdropKey
import io.adrop.ads.model.AdropValue

// Year only (yyyy)
AdropMetrics.setProperty(AdropKey.BIRTH, "1990")

// Year and month (yyyyMM)
AdropMetrics.setProperty(AdropKey.BIRTH, "199003")

// Year, month, and day (yyyyMMdd)
AdropMetrics.setProperty(AdropKey.BIRTH, "19900315")
Date Format Constants
ConstantValueDescription
AdropValue.AdropBirth.formatYear"yyyy"Year only (e.g., “1990”)
AdropValue.AdropBirth.formatYearMonth"yyyyMM"Year and month (e.g., “199003”)
AdropValue.AdropBirth.formatYearMonthDay"yyyyMMdd"Year, month, and day (e.g., “19900315”)

Gender

import io.adrop.ads.metrics.AdropMetrics
import io.adrop.ads.model.AdropKey
import io.adrop.ads.model.AdropValue

// Male
AdropMetrics.setProperty(AdropKey.GENDER, AdropValue.AdropGender.MALE)

// Female
AdropMetrics.setProperty(AdropKey.GENDER, AdropValue.AdropGender.FEMALE)

// Other
AdropMetrics.setProperty(AdropKey.GENDER, AdropValue.AdropGender.OTHER)

// Unknown
AdropMetrics.setProperty(AdropKey.GENDER, AdropValue.UNKNOWN)
Gender Value Constants
ConstantValueDescription
AdropValue.AdropGender.MALE"M"Male
AdropValue.AdropGender.FEMALE"F"Female
AdropValue.AdropGender.OTHER"O"Other
AdropValue.UNKNOWN"U"Unknown

Setting Age Directly

You can also set age directly instead of birthday.
import io.adrop.ads.metrics.AdropMetrics
import io.adrop.ads.model.AdropKey

AdropMetrics.setProperty(AdropKey.AGE, 30)
You only need to set either BIRTH or AGE. If both are set, BIRTH takes precedence.

Custom Properties

You can set custom properties for your service. Custom properties must first be defined in the Targeting menu of the Adrop console.
import io.adrop.ads.metrics.AdropMetrics

// Local activity app example
AdropMetrics.setProperty("region", "Seoul")
AdropMetrics.setProperty("booking_count", 5)

// Shopping mall app example
AdropMetrics.setProperty("membership_tier", "gold")
AdropMetrics.setProperty("total_purchase_amount", 1500000)

// Media app example
AdropMetrics.setProperty("favorite_genres", arrayOf("drama", "action"))
AdropMetrics.setProperty("is_premium_subscriber", true)
Custom property names must exactly match the names defined in the console. Case-sensitive.

Property Usage Example

Example of updating properties when a user enters a specific screen in the app.
import io.adrop.ads.Adrop
import io.adrop.ads.metrics.AdropMetrics
import io.adrop.ads.model.AdropKey
import io.adrop.ads.model.AdropValue

class ProfileActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_profile)

        // Get user info
        val user = getUserInfo()

        // Set UID
        Adrop.setUID(user.id)

        // Set default properties
        AdropMetrics.setProperty(AdropKey.BIRTH, user.birthDate)
        AdropMetrics.setProperty(AdropKey.GENDER, user.gender)

        // Set custom properties
        AdropMetrics.setProperty("membership_level", user.membershipLevel)
        AdropMetrics.setProperty("total_booking_count", user.bookingCount)
    }
}

Context Targeting

Display ads based on content context (category, topic, etc.). Use the contextId property in banner ads and native ads.

Setting in XML

<io.adrop.ads.banner.AdropBanner
    android:id="@+id/adropBanner"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:adrop_unit_id="PUBLIC_TEST_UNIT_ID_320_50"
    app:adrop_context_id="article_sports" />

Setting in Code

import io.adrop.ads.banner.AdropBanner

val adropBanner = AdropBanner(this, "PUBLIC_TEST_UNIT_ID_320_50", "article_sports")

// Or set on existing instance
val existingBanner = findViewById<AdropBanner>(R.id.adropBanner)
// contextId can only be set in the constructor

Native Ads

Native ads can set contextId in the constructor.
import io.adrop.ads.nativead.AdropNativeAd
import io.adrop.ads.nativead.AdropNativeAdListener

val nativeAd = AdropNativeAd(this, "PUBLIC_TEST_UNIT_ID_NATIVE")
nativeAd.listener = object : AdropNativeAdListener {
    override fun onAdReceived(ad: AdropNativeAd) {
        // Ad received successfully
    }

    override fun onAdFailedToReceive(ad: AdropNativeAd, errorCode: Int) {
        // Ad failed to receive
    }
}

// Load ad with contextId
nativeAd.load("article_technology")

Context ID Usage Example

Example of displaying ads based on article category in a news app.
import io.adrop.ads.banner.AdropBanner

class ArticleActivity : AppCompatActivity() {
    private lateinit var adropBanner: AdropBanner

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_article)

        // Get article category
        val articleCategory = getArticleCategory() // "sports", "technology", "entertainment", etc.

        // Create banner with Context ID matching category
        val contextId = "article_$articleCategory"
        adropBanner = AdropBanner(this, "YOUR_UNIT_ID", contextId)

        // Add to layout
        val container = findViewById<ViewGroup>(R.id.ad_container)
        container.addView(adropBanner)

        // Load ad
        adropBanner.load()
    }
}
Context ID must match the context targeting category defined in the console.

Best Practices

1. Set UID Before Loading Ads

// Correct example
Adrop.setUID("user_123")
adropBanner.load()

// Wrong example
adropBanner.load()
Adrop.setUID("user_123") // Targeting won't be applied if set after ad load

2. Use Meaningful Context IDs

// Correct example
val contextId = "article_${article.category}" // "article_sports", "article_tech"
val adropBanner = AdropBanner(this, unitId, contextId)

// Wrong example
val contextId = "page_${randomNumber}" // Meaningless random value
val adropBanner = AdropBanner(this, unitId, contextId)

3. Update Properties Whenever They Change

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        // Set initial properties on app start
        updateUserProperties()
    }

    fun onUserPurchaseComplete(purchaseAmount: Int) {
        // Update properties on purchase completion
        val currentTotal = getCurrentTotalPurchase()
        AdropMetrics.setProperty("total_purchase_amount", currentTotal + purchaseAmount)
    }

    fun onMembershipUpgrade(newTier: String) {
        // Update properties on membership upgrade
        AdropMetrics.setProperty("membership_tier", newTier)
    }
}

4. Reset UID on Logout

fun onUserLogout() {
    // Reset UID
    Adrop.setUID("")

    // Reset properties if needed
    AdropMetrics.setProperty("membership_level", null)
    AdropMetrics.setProperty("total_booking_count", null)
}


FAQ

Ads will still be displayed even without setting UID, but audience targeting won’t be applied. Only basic targeting (country, language, etc.) will be used. Setting UID is essential for sophisticated targeting.
Property data is reflected in the console within up to 24 hours after collection. If data is not displayed:
  1. Verify that properties are correctly defined in the console.
  2. Verify that property keys passed from SDK exactly match the console (case-sensitive).
  3. Verify that AdropMetrics.setProperty() is called before loading ads.
Context ID should be a meaningful string representing the content context. For example:
  • News app: "article_sports", "article_tech", "article_entertainment"
  • Shopping app: "category_fashion", "category_electronics"
  • Video app: "video_drama", "video_comedy"
Set it to match the context targeting category defined in the console.
Yes, string arrays, numeric arrays, and boolean arrays are all supported. For example, you can pass user interests as an array:
AdropMetrics.setProperty("favorite_genres", arrayOf("drama", "action", "comedy"))
Pass null to the property value to delete that property:
AdropMetrics.setProperty("membership_level", null)