Aller au contenu principal

Ad Preferences

The AdPreference is an optional preferences object to be sent whilst loading an ad, such as keywords & location. Setting additional preferences helps Bluestack choose better tailored ads from the network. Following are the full range of preferences available,

You need to import AdPreference component in order to work with AdPreference.

import {
AdPreference,
ProviderType,
GenderType,
LocationType,
} from "@azerion/bluestack-sdk-react-native";

Here's an example of how to create preference for any ad:

const preference = new AdPreference();
preference.setAge(30);
preference.setGender("Female");
preference.setLocation(
{
latitude: 52.2781641,
longitude: 4.7482118,
provider: "network",
},
1
);
preference.setLanguage("en");
preference.setContentUrl("https://madvertise.com/en/");
preference.setKeyword("brand=myBrand;category=sport");

Note :

The SetLocation method takes the following parameters:

  • The Location instance.
  • The CONSENT_FLAG value (corresponds to a int : 0,1,2 or 3).
    • 0 = Not allow to send location.
    • 1 = When you managed location according to consent value.
    • 2 and 3 = Allow the SDK to managed location directly in accordance with the consent value use TCF v1 or TCF v2, see with the madvertise team it depends on your implementation.