Overview
Targeting settings allow you to show personalized ads to specific user groups. The Adrop SDK provides two targeting methods:- Audience Targeting: Display ads based on user attributes (properties).
- Contextual Targeting: Display ads based on content context (category, topic, etc.). Available in SDK 1.17.0 or later.
To collect targeting data, you must set properties before loading ads.
UID Setup (Optional)
Set a user identifier (UID) to share targeting data across platforms. UID is optional and is not required for property-based or event-based targeting.Usage
Parameters
Pass an empty string (
"") on logout to reset the UID.Audience Targeting
Collect user attribute information (properties) to show ads to specific user groups.Setting Properties
Use theAdropMetrics.setProperty() method to collect user attribute information.
Retrieving Properties
UseAdropMetrics.properties() to retrieve all currently set properties.
() => Promise<Record<string, any>>
Returns all currently set properties as a key-value object. Returns an empty object if no properties are set.
Parameters
Built-in Properties
The Adrop SDK provides built-in properties for targeting. UseAdropProperties and AdropGender enums to set values.
Age (Birthday)
When you pass birthday information, age is automatically calculated.Gender
Setting Age Directly
You can also set age directly instead of birthday.You only need to set one of
BIRTH or AGE. If both are set, BIRTH takes priority.Custom Properties
You can set custom properties for your service. Custom properties must be defined first in the Ad Control Console under the Property menu.Property Usage Example
Example of setting properties when a user logs into the app.Contextual Targeting
Display ads based on content context (category, topic, etc.). PasscontextId to banner and native ads. Available in SDK 1.17.0 or later.
First, create contextual targeting in the Ad Control console. See Creating Context Targeting.
Context targeting applies only to banner and native ad requests that include a Context ID (banner and native ads in the Android and iOS SDKs and in the Flutter and React Native SDKs 1.17.0 or later, the Web SDK, and the REST API). Interstitial, rewarded, popup, and splash ads, as well as Flutter and React Native SDKs earlier than 1.17.0, do not send a Context ID. If an ad product that contains these placements uses context targeting, campaigns that include context options are not shown in those placements, and context exclusions are not applied there.
Banner Ads
contextId is read only when the banner mounts. When the screen’s context changes, change key as well so the banner remounts.
Native Ads
contextId is the fourth constructor argument.
- Context IDs are case-sensitive and must exactly match a value entered in a context targeting option’s condition in the console.
- Do not use commas (,) in Context IDs, because a comma separates multiple values both in the console and in an ad request. When requesting ads, pass the value exactly as entered in the console, without leading or trailing spaces.
- To match more than one context in a single request, pass a comma-separated value such as
hiking,outdoor. The first 5 IDs are used, and exclusion takes precedence over inclusion. See Passing Multiple Context IDs. - If you don’t pass a Context ID, or pass a value that isn’t registered in the console, no error occurs. Only campaigns with context targeting are excluded, and other ads can still be served.
Event Tracking
Track user behavior events to build audiences based on user actions. UseAdropMetrics.sendEvent() to send events.
logEvent() is deprecated. Use sendEvent() instead.Sending Events
Multi-Item Events
For events that involve multiple items (e.g., purchase, begin_checkout), pass anitems array in the parameters.
Supported Event Examples
- Event name must be 1–64 characters.
- Parameter key must be 1–64 characters.
- String parameter values are limited to 1024 characters.
Best Practices
1. Set Properties Before Loading Ads
2. Update Properties When They Change
3. Reset Properties on Logout
Related Documentation
Create Audience Targeting
Create audience targeting in the console
Sell Targeting
Set up targeting category sales
Banner Ads
Implementing banner ads
Native Ads
Implementing native ads
FAQ
If I don't set a UID, will targeted ads not be shown?
If I don't set a UID, will targeted ads not be shown?
Ads will still be shown without setting a UID. UID is optional and used for sharing targeting data across platforms. Property-based and event-based targeting work without UID.
I set properties but don't see data in the console.
I set properties but don't see data in the console.
Property data is reflected in the console within 24 hours of collection. If data is not showing:
- Verify the property is correctly defined in the console.
- Check that the property key passed from the SDK exactly matches the console (case-sensitive).
- Verify
AdropMetrics.setProperty()is called before loading ads.
How do I delete a property value?
How do I delete a property value?
Pass
null as the property value to delete it:Can I set array-type properties?
Can I set array-type properties?
The React Native SDK does not currently support array types directly. If needed, convert to a string or split into multiple individual properties.