Overview
Through targeting configuration, you can display customized ads to specific user groups. The Adrop SDK provides Audience Targeting .
Audience Targeting : Displays ads based on user properties (attributes).
To collect targeting data, you must set UID and properties before loading ads.
Setting UID
Set a user identifier (UID) to distinguish users. UID is the foundation for targeted advertising.
Usage
import 'package:adrop_ads_flutter/adrop_ads_flutter.dart' ;
// After user login
await Adrop . setUID ( 'user_123' );
// On user logout
await Adrop . setUID ( '' );
Parameters
Parameter Type Description 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.
When logging out, pass an empty string ('') 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 'package:adrop_ads_flutter/adrop_ads_flutter.dart' ;
// String property
await AdropMetrics . setProperty ( 'membership_level' , 'premium' );
// Numeric property
await AdropMetrics . setProperty ( 'booking_count' , 15 );
// Boolean property
await AdropMetrics . setProperty ( 'is_subscriber' , true );
// Passing null (removes property)
await AdropMetrics . setProperty ( 'membership_level' , null );
Parameters
Parameter Type Description keyStringProperty key (max 64 characters) valuedynamicProperty value (String, int, double, bool, null)
Property keys can be up to 64 characters.
String values can be up to 256 characters.
Numeric values can be up to 9007199254740991.
You can set up to 256 properties.
Default Properties
The Adrop SDK provides default properties for targeting.
Age (Birth Date)
When you pass birth date information, age is automatically calculated.
import 'package:adrop_ads_flutter/adrop_ads_flutter.dart' ;
// Year only (yyyy)
await AdropMetrics . setProperty ( 'birth' , '1990' );
// Year and month (yyyyMM)
await AdropMetrics . setProperty ( 'birth' , '199003' );
// Year, month, and day (yyyyMMdd)
await AdropMetrics . setProperty ( 'birth' , '19900315' );
Date Formats
Format Example Description yyyy”1990” Year only yyyyMM”199003” Year and month yyyyMMdd”19900315” Year, month, and day
Gender
import 'package:adrop_ads_flutter/adrop_ads_flutter.dart' ;
// Male
await AdropMetrics . setProperty ( 'gender' , 'M' );
// Female
await AdropMetrics . setProperty ( 'gender' , 'F' );
// Other
await AdropMetrics . setProperty ( 'gender' , 'O' );
// Unknown
await AdropMetrics . setProperty ( 'gender' , 'U' );
Gender Values
Value Description MMale FFemale OOther UUnknown
Setting Age Directly
You can also set age directly instead of birth date.
await AdropMetrics . setProperty ( '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 that fit your service. Custom properties must be defined first in the Targeting menu of AdControl Console .
import 'package:adrop_ads_flutter/adrop_ads_flutter.dart' ;
// Local activity app example
await AdropMetrics . setProperty ( 'region' , 'Seoul' );
await AdropMetrics . setProperty ( 'booking_count' , 5 );
// Shopping mall app example
await AdropMetrics . setProperty ( 'membership_tier' , 'gold' );
await AdropMetrics . setProperty ( 'total_purchase_amount' , 1500000 );
// Media app example
await AdropMetrics . setProperty ( 'favorite_genre' , 'drama' );
await AdropMetrics . setProperty ( 'is_premium_subscriber' , true );
Custom property names must exactly match the names defined in the console. They are case-sensitive.
Event Logging
You can log events to track user behavior.
Basic Event Logging
import 'package:adrop_ads_flutter/adrop_ads_flutter.dart' ;
// Event name only
await AdropMetrics . logEvent ( 'button_click' );
// With parameters
await AdropMetrics . logEvent ( 'purchase' , {
'item_id' : 'SKU_001' ,
'price' : 29900 ,
'currency' : 'KRW' ,
});
Parameters
Parameter Type Description nameStringEvent name paramsdynamicEvent parameters (optional)
You can set up to 20 parameters per event.
Retrieving Properties
You can retrieve all stored properties.
import 'package:adrop_ads_flutter/adrop_ads_flutter.dart' ;
final properties = await AdropMetrics . properties ();
debugPrint ( 'Stored properties: $ properties ' );
Usage Examples
Setting Properties on Login
import 'package:flutter/material.dart' ;
import 'package:adrop_ads_flutter/adrop_ads_flutter.dart' ;
class LoginScreen extends StatefulWidget {
const LoginScreen ({ super .key});
@override
State < LoginScreen > createState () => _LoginScreenState ();
}
class _LoginScreenState extends State < LoginScreen > {
Future < void > _onLoginSuccess ( User user) async {
// Set UID
await Adrop . setUID (user.id);
// Set default properties
if (user.birthDate != null ) {
await AdropMetrics . setProperty ( 'birth' , user.birthDate);
}
if (user.gender != null ) {
await AdropMetrics . setProperty ( 'gender' , user.gender);
}
// Set custom properties
await AdropMetrics . setProperty ( 'membership_level' , user.membershipLevel);
await AdropMetrics . setProperty ( 'total_booking_count' , user.bookingCount);
// Log login event
await AdropMetrics . logEvent ( 'login' , {
'method' : 'email' ,
'is_first_login' : user.isFirstLogin,
});
// Navigate to main screen
Navigator . of (context). pushReplacement (
MaterialPageRoute (builder : (_) => const MainScreen ()),
);
}
@override
Widget build ( BuildContext context) {
return Scaffold (
// ...
);
}
}
Resetting on Logout
Future < void > _onLogout () async {
// Reset UID
await Adrop . setUID ( '' );
// Reset properties if needed
await AdropMetrics . setProperty ( 'membership_level' , null );
await AdropMetrics . setProperty ( 'total_booking_count' , null );
// Log logout event
await AdropMetrics . logEvent ( 'logout' );
}
Updating Properties
class UserProfile extends StatelessWidget {
void _onPurchaseComplete ( int purchaseAmount) async {
// Update property on purchase completion
final currentTotal = await _getCurrentTotalPurchase ();
await AdropMetrics . setProperty (
'total_purchase_amount' ,
currentTotal + purchaseAmount,
);
// Log purchase event
await AdropMetrics . logEvent ( 'purchase' , {
'amount' : purchaseAmount,
'currency' : 'KRW' ,
});
}
void _onMembershipUpgrade ( String newTier) async {
// Update property on membership upgrade
await AdropMetrics . setProperty ( 'membership_tier' , newTier);
// Log upgrade event
await AdropMetrics . logEvent ( 'membership_upgrade' , {
'new_tier' : newTier,
});
}
@override
Widget build ( BuildContext context) {
return Container ();
}
}
Best Practices
1. Set UID Before Loading Ads
// ✅ Correct example
await Adrop . setUID ( 'user_123' );
// Load ad...
bannerView. load ();
// ❌ Incorrect example
bannerView. load ();
await Adrop . setUID ( 'user_123' ); // Setting after ad load won't apply targeting
2. Update Properties When Changed
class MyApp extends StatefulWidget {
@override
State < MyApp > createState () => _MyAppState ();
}
class _MyAppState extends State < MyApp > {
@override
void initState () {
super . initState ();
// Set initial properties on app start
_updateUserProperties ();
}
Future < void > _updateUserProperties () async {
final user = await getUserInfo ();
await Adrop . setUID (user.id);
await AdropMetrics . setProperty ( 'membership_level' , user.membershipLevel);
}
}
3. Reset UID on Logout
Future < void > onUserLogout () async {
// Reset UID
await Adrop . setUID ( '' );
// Reset properties if needed
await AdropMetrics . setProperty ( 'membership_level' , null );
await AdropMetrics . setProperty ( 'total_booking_count' , null );
}
FAQ
Will targeted ads not be displayed if I don't set UID?
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. UID setting is essential for precise targeting.
I set properties but don't see data in the console.
Property data is reflected in the console within 24 hours after collection. If data is not showing:
Check that the property is correctly defined in the console.
Verify that the property key passed in the SDK exactly matches the console (case-sensitive).
Confirm that AdropMetrics.setProperty() is called before ad loading.
How do I delete property values?
Pass null to the property value to delete that property: await AdropMetrics . setProperty ( 'membership_level' , null );
Are there type restrictions for property values?
Supported types are String, int, double, and bool. Arrays and complex objects are not supported. Convert to string if needed.