Class TargetingParams


  • public class TargetingParams
    extends java.lang.Object
    TargetingParams class sets the Targeting parameters like yob, gender, location and other custom parameters for the adUnits to be made available in the auction.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  TargetingParams.GENDER  
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static void addBidderToAccessControlList​(java.lang.String bidderName)
      This method obtains a bidder name allowed to receive global targeting (ext.prebid.data)
      static void addContextData​(java.lang.String key, java.lang.String value)
      Deprecated.
      use addExtData
      static void addContextKeyword​(java.lang.String keyword)
      Deprecated.
      use addExtKeyword
      static void addContextKeywords​(java.util.Set<java.lang.String> keywords)
      Deprecated.
      use addExtKeywords
      static void addExtData​(java.lang.String key, java.lang.String value)
      This method obtains the context data keyword & value context for global context targeting if the key already exists the value will be appended to the list.
      static void addExtKeyword​(java.lang.String keyword)
      This method obtains the context keyword for adunit context targeting Inserts the given element in the set if it is not already present.
      static void addExtKeywords​(java.util.Set<java.lang.String> keywords)
      This method obtains the context keyword set for adunit context targeting Adds the elements of the given set to the set.
      static void addUserData​(java.lang.String key, java.lang.String value)
      This method obtains the user data keyword & value for global user targeting if the key already exists the value will be appended to the list.
      static void addUserKeyword​(java.lang.String keyword)
      This method obtains the user keyword for global user targeting Inserts the given element in the set if it is not already present.
      static void addUserKeywords​(java.util.Set<java.lang.String> keywords)
      This method obtains the user keyword set for global user targeting Adds the elements of the given set to the set.
      static void clearAccessControlList()
      This method allows to remove all the bidder name set
      static void clearContextData()
      Deprecated.
      use clearExtData
      static void clearContextKeywords()
      Deprecated.
      use clearExtKeywords
      static void clearExtData()
      This method allows to remove all context data set from global context targeting
      static void clearExtKeywords()
      This method allows to remove all keywords from the set of adunit context targeting
      static void clearStoredExternalUserIds()
      Clear the Stored ExternalUserId list from the SharedPreference
      static void clearUserData()
      This method allows to remove all user data set from global user targeting
      static void clearUserKeywords()
      This method allows to remove all keywords from the set of global user targeting
      static ExternalUserId fetchStoredExternalUserId​(java.lang.String source)
      Returns the stored (in the SharedPreference) ExternalUserId instance for a given source
      static java.util.List<ExternalUserId> fetchStoredExternalUserIds()
      Returns the stored (in the SharedPreferences) External User Id list
      static java.util.Set<java.lang.String> getAccessControlList()  
      static java.lang.String getBundleName()
      Get the platform-specific identifier, should be bundle/package name
      static java.lang.String getBuyerId()  
      static java.util.Map<java.lang.String,​java.util.Set<java.lang.String>> getContextDataDictionary()
      Deprecated.
      use getExtDataDictionary
      static java.util.Set<java.lang.String> getContextKeywordsSet()
      Deprecated.
      use getExtKeywordsSet
      static java.lang.Boolean getDeviceAccessConsent()
      Gets the device access consent set by the publisher.

      If custom Prebid subject and purpose consent set, gets device access from them.
      static java.lang.String getDomain()
      Get the domain of your app
      static java.util.Map<java.lang.String,​java.util.Set<java.lang.String>> getExtDataDictionary()  
      static java.util.Set<java.lang.String> getExtKeywordsSet()  
      static java.lang.String getGDPRConsentString()
      Gets any given GDPR consent in that order.
      static TargetingParams.GENDER getGender()
      Get the current user's gender, if it's available.
      static java.lang.String getOmidPartnerName()
      OMID signaling
      static java.lang.String getOmidPartnerVersion()  
      static java.lang.String getPublisherName()  
      static java.lang.Boolean getPurposeConsent​(int index)
      Gets any given purpose consent for set index in that order.
      static java.lang.String getPurposeConsents()
      Gets any given purpose consent for set index in that order.
      static java.lang.String getStoreUrl()
      Get the store url of your app
      static java.lang.Integer getUserAge()  
      static java.lang.String getUserCustomData()  
      static java.util.Map<java.lang.String,​java.util.Set<java.lang.String>> getUserDataDictionary()  
      static Ext getUserExt()  
      static java.lang.String getUserId()  
      static java.lang.String getUserKeywords()  
      static java.util.Set<java.lang.String> getUserKeywordsSet()  
      static android.util.Pair<java.lang.Float,​java.lang.Float> getUserLatLng()  
      static int getYearOfBirth()
      Get the year of birth for targeting
      static java.lang.Boolean isSubjectToCOPPA()
      Gets subject to COPPA.
      static java.lang.Boolean isSubjectToGDPR()
      Gets any given subject to GDPR in that order.
      static void removeBidderFromAccessControlList​(java.lang.String bidderName)
      This method allows to remove specific bidder name
      static void removeContextData​(java.lang.String key)
      Deprecated.
      use removeExtData
      static void removeContextKeyword​(java.lang.String keyword)
      Deprecated.
      use removeExtKeyword
      static void removeExtData​(java.lang.String key)
      This method allows to remove specific context data keyword & values set from global context targeting
      static void removeExtKeyword​(java.lang.String keyword)
      This method allows to remove specific context keyword from adunit context targeting
      static void removeStoredExternalUserId​(java.lang.String source)
      Removes the stored (in the SharedPreference) ExternalUserId instance for a given source
      static void removeUserData​(java.lang.String key)
      This method allows to remove specific user data keyword & value set from global user targeting
      static void removeUserKeyword​(java.lang.String keyword)
      This method allows to remove specific user keyword from global user targeting
      static void setBundleName​(java.lang.String bundleName)
      Set the platform-specific identifier for targeting purpose Should be bundle/package name
      static void setBuyerId​(java.lang.String buyerId)
      Sets buyerId
      static void setDomain​(java.lang.String domain)
      Set the domain of your app for targeting purpose
      static void setGDPRConsentString​(java.lang.String consent)
      Sets GDPR consent for Prebid.
      static void setGender​(TargetingParams.GENDER gender)
      Set the user's gender.
      static void setOmidPartnerName​(java.lang.String omidPartnerName)  
      static void setOmidPartnerVersion​(java.lang.String omidPartnerVersion)  
      static void setPublisherName​(java.lang.String publisherName)
      Sets publisher name
      static void setPurposeConsents​(java.lang.String purposeConsents)
      Sets Prebid custom GDPR purpose consents (device access consent).
      static void setStoreUrl​(java.lang.String storeUrl)
      Set the store url of your app
      static void setSubjectToCOPPA​(java.lang.Boolean value)
      Sets subject to COPPA.
      static void setSubjectToGDPR​(java.lang.Boolean value)
      Sets subject to GDPR for Prebid.
      static void setUserAge​(java.lang.Integer age)  
      static void setUserCustomData​(java.lang.String data)
      Optional feature to pass bidder data that was set in the exchange’s cookie.
      static void setUserExt​(Ext ext)
      Sets user Ext
      static void setUserId​(java.lang.String userId)
      Set the user identifier.
      static void setUserLatLng​(java.lang.Float latitude, java.lang.Float longitude)
      Sets user latitude and longitude
      static void setYearOfBirth​(int yob)
      Set the year of birth and user age for targeting
      static void storeExternalUserId​(ExternalUserId externalUserId)
      Use this API for storing the externalUserId in the SharedPreference.
      static void updateContextData​(java.lang.String key, java.util.Set<java.lang.String> value)
      Deprecated.
      use updateExtData
      static void updateExtData​(java.lang.String key, java.util.Set<java.lang.String> value)
      This method obtains the context data keyword & values set for global context targeting.
      static void updateUserData​(java.lang.String key, java.util.Set<java.lang.String> value)
      This method obtains the user data keyword & values set for global user targeting the values if the key already exist will be replaced with the new set of values
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • BIDDER_NAME_APP_NEXUS

        public static final java.lang.String BIDDER_NAME_APP_NEXUS
        See Also:
        Constant Field Values
      • BIDDER_NAME_RUBICON_PROJECT

        public static final java.lang.String BIDDER_NAME_RUBICON_PROJECT
        See Also:
        Constant Field Values
    • Method Detail

      • setUserAge

        public static void setUserAge​(java.lang.Integer age)
      • getUserAge

        public static java.lang.Integer getUserAge()
      • getYearOfBirth

        public static int getYearOfBirth()
        Get the year of birth for targeting
        Returns:
        yob
      • setYearOfBirth

        public static void setYearOfBirth​(int yob)
                                   throws java.lang.Exception
        Set the year of birth and user age for targeting
        Parameters:
        yob - yob of the user
        Throws:
        java.lang.Exception
      • getGender

        public static TargetingParams.GENDER getGender()
        Get the current user's gender, if it's available. The default value is UNKNOWN.
        Returns:
        The user's gender.
      • setGender

        public static void setGender​(TargetingParams.GENDER gender)
        Set the user's gender. This should be set if the user's gender is known, as it can help make buying the ad space more attractive to advertisers. The default value is UNKNOWN.
        Parameters:
        gender - The user's gender.
      • setUserLatLng

        public static void setUserLatLng​(java.lang.Float latitude,
                                         java.lang.Float longitude)
        Sets user latitude and longitude
        Parameters:
        latitude - User latitude
        longitude - User longitude
      • getUserLatLng

        public static android.util.Pair<java.lang.Float,​java.lang.Float> getUserLatLng()
      • addUserData

        public static void addUserData​(java.lang.String key,
                                       java.lang.String value)
        This method obtains the user data keyword & value for global user targeting if the key already exists the value will be appended to the list. No duplicates will be added
      • updateUserData

        public static void updateUserData​(java.lang.String key,
                                          java.util.Set<java.lang.String> value)
        This method obtains the user data keyword & values set for global user targeting the values if the key already exist will be replaced with the new set of values
      • removeUserData

        public static void removeUserData​(java.lang.String key)
        This method allows to remove specific user data keyword & value set from global user targeting
      • clearUserData

        public static void clearUserData()
        This method allows to remove all user data set from global user targeting
      • getUserDataDictionary

        public static java.util.Map<java.lang.String,​java.util.Set<java.lang.String>> getUserDataDictionary()
      • addUserKeyword

        public static void addUserKeyword​(java.lang.String keyword)
        This method obtains the user keyword for global user targeting Inserts the given element in the set if it is not already present.
      • addUserKeywords

        public static void addUserKeywords​(java.util.Set<java.lang.String> keywords)
        This method obtains the user keyword set for global user targeting Adds the elements of the given set to the set.
      • removeUserKeyword

        public static void removeUserKeyword​(java.lang.String keyword)
        This method allows to remove specific user keyword from global user targeting
      • clearUserKeywords

        public static void clearUserKeywords()
        This method allows to remove all keywords from the set of global user targeting
      • getUserKeywords

        public static java.lang.String getUserKeywords()
      • getUserKeywordsSet

        public static java.util.Set<java.lang.String> getUserKeywordsSet()
      • setUserCustomData

        public static void setUserCustomData​(java.lang.String data)
        Optional feature to pass bidder data that was set in the exchange’s cookie. The string must be in base85 cookie safe characters and be in any format. Proper JSON encoding must be used to include “escaped” quotation marks.
        Parameters:
        data - Custom data to be passed
      • getUserCustomData

        public static java.lang.String getUserCustomData()
      • setUserId

        public static void setUserId​(java.lang.String userId)
        Set the user identifier.
        Parameters:
        userId - the new user identifier
      • getUserId

        public static java.lang.String getUserId()
      • setBuyerId

        public static void setBuyerId​(java.lang.String buyerId)
        Sets buyerId
        Parameters:
        buyerId - Buyer-specific ID for the user as mapped by the exchange for the buyer. At least one of buyeruid or id is recommended.
      • getBuyerId

        public static java.lang.String getBuyerId()
      • storeExternalUserId

        public static void storeExternalUserId​(ExternalUserId externalUserId)
        Use this API for storing the externalUserId in the SharedPreference. Prebid server provide them participating server-side bid adapters.
        Parameters:
        externalUserId - the externalUserId instance to be stored in the SharedPreference
      • fetchStoredExternalUserId

        public static ExternalUserId fetchStoredExternalUserId​(java.lang.String source)
        Returns the stored (in the SharedPreference) ExternalUserId instance for a given source
      • fetchStoredExternalUserIds

        public static java.util.List<ExternalUserId> fetchStoredExternalUserIds()
        Returns the stored (in the SharedPreferences) External User Id list
      • removeStoredExternalUserId

        public static void removeStoredExternalUserId​(java.lang.String source)
        Removes the stored (in the SharedPreference) ExternalUserId instance for a given source
      • clearStoredExternalUserIds

        public static void clearStoredExternalUserIds()
        Clear the Stored ExternalUserId list from the SharedPreference
      • setPublisherName

        public static void setPublisherName​(java.lang.String publisherName)
        Sets publisher name
        Parameters:
        publisherName - Publisher name
      • getPublisherName

        public static java.lang.String getPublisherName()
      • setDomain

        public static void setDomain​(java.lang.String domain)
        Set the domain of your app for targeting purpose
        Parameters:
        domain - domain of your app
      • getDomain

        public static java.lang.String getDomain()
        Get the domain of your app
        Returns:
        domain of your app
      • setStoreUrl

        public static void setStoreUrl​(java.lang.String storeUrl)
        Set the store url of your app
        Parameters:
        storeUrl - store url
      • getStoreUrl

        public static java.lang.String getStoreUrl()
        Get the store url of your app
        Returns:
        store url
      • getBundleName

        public static java.lang.String getBundleName()
        Get the platform-specific identifier, should be bundle/package name
      • setBundleName

        public static void setBundleName​(java.lang.String bundleName)
        Set the platform-specific identifier for targeting purpose Should be bundle/package name
      • addContextData

        @Deprecated
        public static void addContextData​(java.lang.String key,
                                          java.lang.String value)
        Deprecated.
        use addExtData
        This method obtains the context data keyword & value context for global context targeting if the key already exists the value will be appended to the list. No duplicates will be added (app.ext.data)
      • updateContextData

        @Deprecated
        public static void updateContextData​(java.lang.String key,
                                             java.util.Set<java.lang.String> value)
        Deprecated.
        use updateExtData
        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
      • removeContextData

        @Deprecated
        public static void removeContextData​(java.lang.String key)
        Deprecated.
        use removeExtData
        This method allows to remove specific context data keyword & values set from global context targeting
      • clearContextData

        @Deprecated
        public static void clearContextData()
        Deprecated.
        use clearExtData
        This method allows to remove all context data set from global context targeting
      • getContextDataDictionary

        @Deprecated
        public static java.util.Map<java.lang.String,​java.util.Set<java.lang.String>> getContextDataDictionary()
        Deprecated.
        use getExtDataDictionary
      • addContextKeyword

        @Deprecated
        public static void addContextKeyword​(java.lang.String keyword)
        Deprecated.
        use addExtKeyword
        This method obtains the context keyword for adunit context targeting Inserts the given element in the set if it is not already present. (imp[].ext.context.keywords)
      • addContextKeywords

        @Deprecated
        public static void addContextKeywords​(java.util.Set<java.lang.String> keywords)
        Deprecated.
        use addExtKeywords
        This method obtains the context keyword set for adunit context targeting Adds the elements of the given set to the set.
      • removeContextKeyword

        @Deprecated
        public static void removeContextKeyword​(java.lang.String keyword)
        Deprecated.
        use removeExtKeyword
        This method allows to remove specific context keyword from adunit context targeting
      • clearContextKeywords

        @Deprecated
        public static void clearContextKeywords()
        Deprecated.
        use clearExtKeywords
        This method allows to remove all keywords from the set of adunit context targeting
      • getContextKeywordsSet

        @Deprecated
        public static java.util.Set<java.lang.String> getContextKeywordsSet()
        Deprecated.
        use getExtKeywordsSet
      • addExtData

        public static void addExtData​(java.lang.String key,
                                      java.lang.String value)
        This method obtains the context data keyword & value context for global context targeting if the key already exists the value will be appended to the list. No duplicates will be added (app.ext.data)
      • updateExtData

        public static void updateExtData​(java.lang.String key,
                                         java.util.Set<java.lang.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

        public static void removeExtData​(java.lang.String key)
        This method allows to remove specific context data keyword & values set from global context targeting
      • clearExtData

        public static void clearExtData()
        This method allows to remove all context data set from global context targeting
      • getExtDataDictionary

        public static java.util.Map<java.lang.String,​java.util.Set<java.lang.String>> getExtDataDictionary()
      • addExtKeyword

        public static void addExtKeyword​(java.lang.String keyword)
        This method obtains the context keyword for adunit context targeting Inserts the given element in the set if it is not already present. (imp[].ext.context.keywords)
      • addExtKeywords

        public static void addExtKeywords​(java.util.Set<java.lang.String> keywords)
        This method obtains the context keyword set for adunit context targeting Adds the elements of the given set to the set.
      • removeExtKeyword

        public static void removeExtKeyword​(java.lang.String keyword)
        This method allows to remove specific context keyword from adunit context targeting
      • clearExtKeywords

        public static void clearExtKeywords()
        This method allows to remove all keywords from the set of adunit context targeting
      • getExtKeywordsSet

        public static java.util.Set<java.lang.String> getExtKeywordsSet()
      • addBidderToAccessControlList

        public static void addBidderToAccessControlList​(java.lang.String bidderName)
        This method obtains a bidder name allowed to receive global targeting (ext.prebid.data)
      • removeBidderFromAccessControlList

        public static void removeBidderFromAccessControlList​(java.lang.String bidderName)
        This method allows to remove specific bidder name
      • clearAccessControlList

        public static void clearAccessControlList()
        This method allows to remove all the bidder name set
      • getAccessControlList

        public static java.util.Set<java.lang.String> getAccessControlList()
      • getOmidPartnerName

        public static java.lang.String getOmidPartnerName()
        OMID signaling
      • setOmidPartnerName

        public static void setOmidPartnerName​(java.lang.String omidPartnerName)
      • getOmidPartnerVersion

        public static java.lang.String getOmidPartnerVersion()
      • setOmidPartnerVersion

        public static void setOmidPartnerVersion​(java.lang.String omidPartnerVersion)
      • getPurposeConsent

        public static java.lang.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 PrebidMobile.initializeSdk(Context, SdkInitializationListener).

      • getPurposeConsents

        public static java.lang.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 PrebidMobile.initializeSdk(Context, SdkInitializationListener).

      • getDeviceAccessConsent

        public static java.lang.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 PrebidMobile.initializeSdk(Context, SdkInitializationListener).

      • setUserExt

        public static void setUserExt​(Ext ext)
        Sets user Ext
        Parameters:
        ext - Placeholder for exchange-specific extensions to OpenRTB.
      • getUserExt

        public static Ext getUserExt()