Aller au contenu principal
Version: 6.x.x

Targeting Audiences

To take advantage of our targeting campaigns, pass an immutable RequestOptions instance to the Load(...) call on any ad format.

using Azerion.BlueStack.API;

var requestOptions = new RequestOptions(
age: 25,
gender: Gender.Male,
location: new Location(35.757866, 10.810547, Location.GPS_PROVIDER),
consentFlag: 1,
language: "en",
keyword: "brand=myBrand;category=sport",
contentUrl: "https://example.com");

_bannerAd.Load(requestOptions);
_interstitialAd.Load(requestOptions);
_rewardedAd.Load(requestOptions);
_nativeAdLoader.Load(requestOptions);

RequestOptions is immutable, every field is set at construction time. A single instance can be passed to multiple Load calls. To target a different request, construct a new RequestOptions.

All constructor parameters are optional; omit any field you don't want to send.

Field reference​

ParameterTypeDescription
ageint?User's age in years.
genderGender?Gender.Male, Gender.Female, or Gender.Unknown.
locationLocationImmutable Location(latitude, longitude, provider). Pair with consentFlag.
consentFlagint?Consent flag for location data (see Location Targeting below).
languagestringBCP-47 language tag (e.g. "en-US"). Android only
keywordstringkey=value;key=value pairs for contextual targeting.
contentUrlstringURL of the content adjacent to the ad; used for contextual targeting and brand safety.

Location Targeting​

The ad server can use a user's location to deliver more relevant ads. Build an immutable Location with latitude / longitude / provider, then pass it together with a consentFlag:

var requestOptions = new RequestOptions(
location: new Location(35.757866, 10.810547, Location.GPS_PROVIDER),
consentFlag: 1
);

The Location class exposes following provider constants, Location.GPS_PROVIDER, Location.NETWORK_PROVIDER, Location.PASSIVE_PROVIDER, or Location.NONE_PROVIDER.

consentFlag values:

  • 0 — Do not send location.
  • 1 — Send location according to your own consent management.
  • 2 / 3 — Let the SDK manage location based on TCF v1 / TCF v2 consent. Behavior depends on your implementation; check with the Azerion team.
attention

Do not serialize a Location instance (for example into a string via a JSON library) and reuse it later. Use the constructor directly each time.


Keyword Targeting​

Keywords let you target ad requests with user-derived data. They are most useful when paired with dynamic values per user / device.

Format keywords as key=value pairs separated by ;. Limits:

  • Characters per key: 20
  • Characters per value: 40
var requestOptions = new RequestOptions(
keyword: "brand=myBrand;category=sport"
);

User Demographic Targeting​

When the user has shared demographic information through your app's settings, pass it through RequestOptions:

var requestOptions = new RequestOptions(
age: 25,
gender: Gender.Male
);

Gender is an enum: Gender.Male, Gender.Female, or Gender.Unknown.


BlueStack Audience Targeting​

Audiences can be defined by date of birth, gender, location, Apple's Advertising Identifier (IDFA), Android's advertising ID, or a combination of rules used to identify users who took specific actions on your app (device, carrier, …). Configure audiences through the BlueStack console.


Content Mapping​

Pass the URL of the page or content adjacent to the ad to support contextual targeting and brand safety (Google reference):

var requestOptions = new RequestOptions(
contentUrl: "https://example.com/article/123"
);