Skip to main content

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 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

import 'package:adrop_ads_flutter/adrop_ads_flutter.dart';

// After user login (optional)
await Adrop.setUID('user_123');

// On user logout
await 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.
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

ParameterTypeDescription
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
FormatExampleDescription
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('GDR', 'M');

// Female
await AdropMetrics.setProperty('GDR', 'F');

// Other
await AdropMetrics.setProperty('GDR', 'O');

// Unknown
await AdropMetrics.setProperty('GDR', 'U');
Gender Values
ValueDescription
MMale
FFemale
OOther
UUnknown
You can also use the AdropProperties and AdropGender enums provided by the SDK:
import 'package:adrop_ads_flutter/adrop_ads_flutter.dart';

await AdropMetrics.setProperty(AdropProperties.birth.code, '19900315');
await AdropMetrics.setProperty(AdropProperties.gender.code, AdropGender.male.code);
await AdropMetrics.setProperty(AdropProperties.age.code, 35);

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 Ad Control 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 Tracking

You can send events to track user behavior.

Sending Events

import 'package:adrop_ads_flutter/adrop_ads_flutter.dart';

// Event name only
await AdropMetrics.sendEvent('click');

// With parameters
await AdropMetrics.sendEvent('purchase', {
  'item_id': 'SKU_001',
  'price': 29900,
  'currency': 'KRW',
});

Parameters

ParameterTypeDescription
nameStringEvent name
paramsMap<String, dynamic>?Event parameters (optional). Supports String, int, double, bool values.
You can set up to 20 parameters per event.
logEvent() is deprecated since version 1.8.0. Use sendEvent() instead.

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 default properties
    if (user.birthDate != null) {
      await AdropMetrics.setProperty('BIRTH', user.birthDate);
    }
    if (user.gender != null) {
      await AdropMetrics.setProperty('GDR', user.gender);
    }

    // Set custom properties
    await AdropMetrics.setProperty('membership_level', user.membershipLevel);
    await AdropMetrics.setProperty('total_booking_count', user.bookingCount);

    // Send sign-up event
    await AdropMetrics.sendEvent('sign_up', {
      'method': 'email',
    });

    // 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 properties if needed
  await AdropMetrics.setProperty('membership_level', null);
  await AdropMetrics.setProperty('total_booking_count', null);
}

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,
    );

    // Send purchase event
    await AdropMetrics.sendEvent('purchase', {
      'amount': purchaseAmount,
      'currency': 'KRW',
    });
  }

  void _onMembershipUpgrade(String newTier) async {
    // Update property on membership upgrade
    await AdropMetrics.setProperty('membership_tier', newTier);

    // Send upgrade event
    await AdropMetrics.sendEvent('membership_upgrade', {
      'new_tier': newTier,
    });
  }

  @override
  Widget build(BuildContext context) {
    return Container();
  }
}

Best Practices

1. Set Properties Before Loading Ads

// ✅ Correct example
await AdropMetrics.setProperty('membership_level', 'premium');
// Load ad...
bannerView.load();

// ❌ Incorrect example
bannerView.load();
await AdropMetrics.setProperty('membership_level', 'premium'); // 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 AdropMetrics.setProperty('membership_level', user.membershipLevel);
  }
}

3. Reset Properties on Logout

Future<void> onUserLogout() async {
  // Reset properties if needed
  await AdropMetrics.setProperty('membership_level', null);
  await AdropMetrics.setProperty('total_booking_count', null);
}

Create Audience Targeting

Create audience targeting in the console

Sell Targeting

Configure targeting category sales

Banner Ads

Implement banner ads

Native Ads

Implement native ads

FAQ

UID is optional. Property-based and event-based targeting work normally without setting UID. UID is used for sharing targeting data across platforms.
Property data is reflected in the console within 24 hours after collection. If data is not showing:
  1. Check that the property is correctly defined in the console.
  2. Verify that the property key passed in the SDK exactly matches the console (case-sensitive).
  3. Confirm that AdropMetrics.setProperty() is called before ad loading.
Pass null to the property value to delete that property:
await AdropMetrics.setProperty('membership_level', null);
Supported types are String, int, double, and bool. Arrays and complex objects are not supported. Convert to string if needed.