-
public class TargetingParamsTargetingParams class sets the Targeting parameters like yob, gender, location and other custom parameters for the adUnits to be made available in the auction.
-
-
Field Summary
Fields Modifier and Type Field Description private static StringpublisherNameprivate static Stringdomainprivate static StringstoreUrlprivate static StringbundleNameprivate static StringomidPartnerNameprivate static StringomidPartnerVersionprivate static ExtuserExtprivate static BooleansendSharedIdprivate static IntegerlocationDecimalPrecisionprivate final static Set<String>accessControlListprivate final static Set<String>userKeywordsSetprivate final static Map<String, Set<String>>extDataDictionary
-
Method Summary
Modifier and Type Method Description static StringgetPublisherName()static voidsetPublisherName(String publisherName)Sets publisher name static synchronized StringgetDomain()Get the domain of your app static synchronized voidsetDomain(String domain)Set the domain of your app for targeting purpose static synchronized StringgetStoreUrl()Get the store url of your app static synchronized voidsetStoreUrl(String storeUrl)Set the store url of your app static synchronized StringgetBundleName()Get the platform-specific identifier, should be bundle/package name static synchronized voidsetBundleName(String bundleName)Set the platform-specific identifier for targeting purposeShould be bundle/package name static StringgetOmidPartnerName()OMID signaling static voidsetOmidPartnerName(@Nullable() String omidPartnerName)static StringgetOmidPartnerVersion()static voidsetOmidPartnerVersion(@Nullable() String omidPartnerVersion)static ExtgetUserExt()static voidsetUserExt(Ext ext)Sets user Ext static BooleangetSendSharedId()static voidsetSendSharedId(Boolean sendSharedId)When true, the SharedID external user id is added to outgoing auction requests.App developers are encouraged to consult with their legal team before enabling this feature.See `TargetingParams.sharedId` for details. static IntegergetLocationDecimalPrecision()Gets the current decimal precision setting for location coordinates. static voidsetLocationDecimalPrecision(@Nullable() Integer precision)Sets the decimal precision for location coordinates (latitude/longitude) in geo-targeting.This helps control the precision of location data sent in ad requests for privacy purposes. static Set<String>getAccessControlList()static Set<String>getUserKeywordsSet()static Map<String, Set<String>>getExtDataDictionary()static voidsetUserLatLng(Float latitude, Float longitude)Sets user latitude and longitude static Pair<Float, Float>getUserLatLng()static voidaddUserKeyword(String keyword)This method obtains the user keyword for global user targetingInserts the given element in the set if it is not already present. static voidaddUserKeywords(Set<String> keywords)This method obtains the user keyword set for global user targetingAdds the elements of the given set to the set. static voidremoveUserKeyword(String keyword)This method allows to remove specific user keyword from global user targeting static voidclearUserKeywords()This method allows to remove all keywords from the set of global user targeting static StringgetUserKeywords()static voidsetExternalUserIds(@Nullable() List<ExternalUserId> userIds)Sets external user ids. static List<ExternalUserId>getExternalUserIds()Returns external user ids. static ExternalUserIdgetSharedId()A randomly generated Prebid-owned first-party identifierUnless reset, SharedID remains consistent throughout the current app session. static voidresetSharedId()Resets and clears out of local storage the existing SharedID value, after which `TargetingParams.sharedId` willreturn a new randomized value. static voidaddExtData(String key, String value)This method obtains the context data keyword & value context for global context targetingif the key already exists the value will be appended to the list. static voidupdateExtData(String key, Set<String> value)This method obtains the context data keyword & values set for global context targeting. static voidremoveExtData(String key)This method allows to remove specific context data keyword & values set from global context targeting static voidclearExtData()This method allows to remove all context data set from global context targeting static voidaddBidderToAccessControlList(String bidderName)This method obtains a bidder name allowed to receive global targeting(ext.prebid. static voidremoveBidderFromAccessControlList(String bidderName)This method allows to remove specific bidder name static voidclearAccessControlList()This method allows to remove all the bidder name set static voidsetSubjectToCOPPA(@Nullable() Boolean value)Sets subject to COPPA. static BooleanisSubjectToCOPPA()Gets subject to COPPA. static voidsetSubjectToGDPR(@Nullable() Boolean value)Sets subject to GDPR for Prebid. static BooleanisSubjectToGDPR()Gets any given subject to GDPR in that order. static voidsetGDPRConsentString(@Nullable() String consent)Sets GDPR consent for Prebid. static StringgetGDPRConsentString()Gets any given GDPR consent in that order. static voidsetPurposeConsents(@Nullable() String purposeConsents)Sets Prebid custom GDPR purpose consents (device access consent). static BooleangetPurposeConsent(int index)Gets any given purpose consent for set index in that order. static StringgetPurposeConsents()Gets any given purpose consent for set index in that order. static BooleangetDeviceAccessConsent()Gets the device access consent set by the publisher. static StringgetGlobalOrtbConfig()static voidsetGlobalOrtbConfig(String config)Sets global OpenRTB JSON string for merging with the original request. -
-
Method Detail
-
getPublisherName
static String getPublisherName()
-
setPublisherName
static void setPublisherName(String publisherName)
Sets publisher name
- Parameters:
publisherName- Publisher name
-
setDomain
static synchronized void setDomain(String domain)
Set the domain of your app for targeting purpose
- Parameters:
domain- domain of your app
-
getStoreUrl
static synchronized String getStoreUrl()
Get the store url of your app
-
setStoreUrl
static synchronized void setStoreUrl(String storeUrl)
Set the store url of your app
- Parameters:
storeUrl- store url
-
getBundleName
static synchronized String getBundleName()
Get the platform-specific identifier, should be bundle/package name
-
setBundleName
static synchronized void setBundleName(String bundleName)
Set the platform-specific identifier for targeting purposeShould be bundle/package name
-
getOmidPartnerName
@Nullable() static String getOmidPartnerName()
OMID signaling
-
setOmidPartnerName
static void setOmidPartnerName(@Nullable() String omidPartnerName)
-
getOmidPartnerVersion
@Nullable() static String getOmidPartnerVersion()
-
setOmidPartnerVersion
static void setOmidPartnerVersion(@Nullable() String omidPartnerVersion)
-
getUserExt
static Ext getUserExt()
-
setUserExt
static void setUserExt(Ext ext)
Sets user Ext
- Parameters:
ext- Placeholder for exchange-specific extensions to OpenRTB.
-
getSendSharedId
static Boolean getSendSharedId()
-
setSendSharedId
static void setSendSharedId(Boolean sendSharedId)
When true, the SharedID external user id is added to outgoing auction requests.App developers are encouraged to consult with their legal team before enabling this feature.See `TargetingParams.sharedId` for details.
- Parameters:
sendSharedId- the Boolean flag to determine if the SharedID external user idis to be added to outgoing auction requests
-
getLocationDecimalPrecision
@Nullable() static Integer getLocationDecimalPrecision()
Gets the current decimal precision setting for location coordinates.
-
setLocationDecimalPrecision
static void setLocationDecimalPrecision(@Nullable() Integer precision)
Sets the decimal precision for location coordinates (latitude/longitude) in geo-targeting.This helps control the precision of location data sent in ad requests for privacy purposes.
Precision levels and their practical meaning:
- null = No precision limit (default, maintains current behavior)
- 0 = Whole numbers (~111 km precision)
- 1 = ~11.1 km precision
- 2 = ~1.1 km precision
- 3 = ~110 m precision
- 4 = ~11 m precision
- 5 = ~1.1 m precision
- 6 = ~0.11 m precision (maximum recommended)
Values outside the 0-6 range will be clamped to valid range.
- Parameters:
precision- Number of decimal places to keep, or null for no limit
-
getAccessControlList
static Set<String> getAccessControlList()
-
getUserKeywordsSet
static Set<String> getUserKeywordsSet()
-
getExtDataDictionary
static Map<String, Set<String>> getExtDataDictionary()
-
setUserLatLng
static void setUserLatLng(Float latitude, Float longitude)
Sets user latitude and longitude
- Parameters:
latitude- User latitudelongitude- User longitude
-
getUserLatLng
static Pair<Float, Float> getUserLatLng()
-
addUserKeyword
static void addUserKeyword(String keyword)
This method obtains the user keyword for global user targetingInserts the given element in the set if it is not already present.
-
addUserKeywords
static void addUserKeywords(Set<String> keywords)
This method obtains the user keyword set for global user targetingAdds the elements of the given set to the set.
-
removeUserKeyword
static void removeUserKeyword(String keyword)
This method allows to remove specific user keyword from global user targeting
-
clearUserKeywords
static void clearUserKeywords()
This method allows to remove all keywords from the set of global user targeting
-
getUserKeywords
static String getUserKeywords()
-
setExternalUserIds
static void setExternalUserIds(@Nullable() List<ExternalUserId> userIds)
Sets external user ids. Set null for clearing.See: ExternalUserId.
-
getExternalUserIds
static List<ExternalUserId> getExternalUserIds()
Returns external user ids.
-
getSharedId
static ExternalUserId getSharedId()
A randomly generated Prebid-owned first-party identifierUnless reset, SharedID remains consistent throughout the current app session. The same id may also persistindefinitely across multiple app sessions if local storage access is allowed. SharedID values are NOT consistentacross different apps on the same device.Note: SharedId is only sent with auction requests if `TargetingParams.sendSharedId` is set to true.
-
resetSharedId
static void resetSharedId()
Resets and clears out of local storage the existing SharedID value, after which `TargetingParams.sharedId` willreturn a new randomized value.
-
addExtData
static void addExtData(String key, String value)
This method obtains the context data keyword & value context for global context targetingif the key already exists the value will be appended to the list. No duplicates will be added(app.ext.data)
-
updateExtData
static void updateExtData(String key, Set<String> value)
This method obtains the context data keyword & values set for global context targeting.the values if the key already exist will be replaced with the new set of values
-
removeExtData
static void removeExtData(String key)
This method allows to remove specific context data keyword & values set from global context targeting
-
clearExtData
static void clearExtData()
This method allows to remove all context data set from global context targeting
-
addBidderToAccessControlList
static void addBidderToAccessControlList(String bidderName)
This method obtains a bidder name allowed to receive global targeting(ext.prebid.data)
-
removeBidderFromAccessControlList
static void removeBidderFromAccessControlList(String bidderName)
This method allows to remove specific bidder name
-
clearAccessControlList
static void clearAccessControlList()
This method allows to remove all the bidder name set
-
setSubjectToCOPPA
static void setSubjectToCOPPA(@Nullable() Boolean value)
Sets subject to COPPA. Null to set undefined.
Must be called only after initializeSdk.
-
isSubjectToCOPPA
@Nullable() static Boolean isSubjectToCOPPA()
Gets subject to COPPA. Null is undefined.
Must be called only after initializeSdk.
-
setSubjectToGDPR
static void setSubjectToGDPR(@Nullable() Boolean value)
Sets subject to GDPR for Prebid. It uses custom static field, not IAB.
Must be called only after initializeSdk.
-
isSubjectToGDPR
@Nullable() static Boolean isSubjectToGDPR()
Gets any given subject to GDPR in that order. 1) Prebid subject to GDPR custom value, if present. 2) IAB subject to GDPR TCF 2.0. Otherwise, null.
Must be called only after initializeSdk.
-
setGDPRConsentString
static void setGDPRConsentString(@Nullable() String consent)
Sets GDPR consent for Prebid. It uses custom static field, not IAB.
Must be called only after initializeSdk.
-
getGDPRConsentString
@Nullable() static String getGDPRConsentString()
Gets any given GDPR consent in that order. 1) Prebid GDPR consent custom value, if present. 2) IAB GDPR consent TCF 2.0. Otherwise, null.
Must be called only after initializeSdk.
-
setPurposeConsents
static void setPurposeConsents(@Nullable() String purposeConsents)
Sets Prebid custom GDPR purpose consents (device access consent).
Must be called only after initializeSdk.
-
getPurposeConsent
@Nullable() static Boolean getPurposeConsent(int index)
Gets any given purpose consent for set index in that order. 1) Prebid GDPR purpose consent custom value, if present. 2) IAB GDPR TCF 2.0 purpose consent. Returns null if purpose consent isn't set or index is out of bounds.
Must be called only after initializeSdk.
-
getPurposeConsents
@Nullable() static String getPurposeConsents()
Gets any given purpose consent for set index in that order. 1) Prebid GDPR purpose consent custom value, if present. 2) IAB GDPR TCF 2.0 purpose consent. Otherwise, null.
Must be called only after initializeSdk.
-
getDeviceAccessConsent
@Nullable() static Boolean getDeviceAccessConsent()
Gets the device access consent set by the publisher.If custom Prebid subject and purpose consent set, gets device access from them.Otherwise, from IAB standard.
Must be called only after initializeSdk.
-
getGlobalOrtbConfig
@Nullable() static String getGlobalOrtbConfig()
-
setGlobalOrtbConfig
static void setGlobalOrtbConfig(String config)
Sets global OpenRTB JSON string for merging with the original request.Expected format:
{@code "{"new_field": "value"}"}.- Parameters:
config- JSON OpenRTB string.
-
-
-
-