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 
      Modifier and Type Method Description
      static void addBidderToAccessControlList​(java.lang.String bidderName)
      This method obtains a bidder name allowed to receive global targeting
      static void addContextData​(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 addContextKeyword​(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 addContextKeywords​(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()
      This method allows to remove all context data set from global context targeting
      static void clearContextKeywords()
      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.lang.String getBundleName()
      Get the platform-specific identifier, should be bundle/package name
      static java.lang.Boolean getDeviceAccessConsent()
      Get the device access Consent set by the publisher.
      static java.lang.String getDomain()
      Get the domain of your app
      static java.lang.String getGDPRConsentString()  
      static TargetingParams.GENDER getGender()
      Get the current user's gender, if it's available.
      static java.lang.String getOmidPartnerName()  
      static java.lang.String getOmidPartnerVersion()  
      static java.lang.String getPurposeConsents()  
      static java.lang.String getStoreUrl()
      Get the store url of your app
      static int getYearOfBirth()
      Get the year of birth for targeting
      static boolean isSubjectToCOPPA()  
      static java.lang.Boolean isSubjectToGDPR()  
      static void removeBidderFromAccessControlList​(java.lang.String bidderName)
      This method allows to remove specific bidder name
      static void removeContextData​(java.lang.String key)
      This method allows to remove specific context data keyword & values set from global context targeting
      static void removeContextKeyword​(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 setDomain​(java.lang.String domain)
      Set the domain of your app for targeting purpose
      static void setGDPRConsentString​(java.lang.String string)  
      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 setPurposeConsents​(java.lang.String purposeConsents)  
      static void setStoreUrl​(java.lang.String storeUrl)
      Set the store url of your app
      static void setSubjectToCOPPA​(boolean isCoppa)  
      static void setSubjectToGDPR​(java.lang.Boolean consent)  
      static void setYearOfBirth​(int yob)
      Set the year of birth 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)
      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

      • isSubjectToCOPPA

        public static boolean isSubjectToCOPPA()
      • setSubjectToCOPPA

        public static void setSubjectToCOPPA​(boolean isCoppa)
      • isSubjectToGDPR

        @Nullable
        public static java.lang.Boolean isSubjectToGDPR()
      • setSubjectToGDPR

        public static void setSubjectToGDPR​(@Nullable
                                            java.lang.Boolean consent)
      • getGDPRConsentString

        @Nullable
        public static java.lang.String getGDPRConsentString()
      • setGDPRConsentString

        public static void setGDPRConsentString​(@Nullable
                                                java.lang.String string)
      • setPurposeConsents

        public static void setPurposeConsents​(@Nullable
                                              java.lang.String purposeConsents)
      • getPurposeConsents

        public static java.lang.String getPurposeConsents()
      • fetchStoredExternalUserIds

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

        public static ExternalUserId fetchStoredExternalUserId​(@NonNull
                                                               java.lang.String source)
        Returns the stored (in the SharedPreference) ExternalUserId instance for a given source
        Parameters:
        source -
      • removeStoredExternalUserId

        public static void removeStoredExternalUserId​(@NonNull
                                                      java.lang.String source)
        Removes the stored (in the SharedPreference) ExternalUserId instance for a given source
        Parameters:
        source -
      • storeExternalUserId

        public static void storeExternalUserId​(ExternalUserId externalUserId)
        Use this API for storing the externalUserId in the SharedPreference
        Parameters:
        externalUserId - the externalUserId instance to be stored in the SharedPreference
      • clearStoredExternalUserIds

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

        @Nullable
        public static java.lang.Boolean getDeviceAccessConsent()
        Get the device access Consent set by the publisher.
        Returns:
        A valid Base64 encode consent string as per https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework or null if not set
      • 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 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.
      • 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
      • 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
      • addBidderToAccessControlList

        public static void addBidderToAccessControlList​(java.lang.String bidderName)
        This method obtains a bidder name allowed to receive global targeting
      • 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
      • 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
      • 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
      • addContextData

        public static void addContextData​(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
      • updateContextData

        public static void updateContextData​(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
      • removeContextData

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

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

        public static void addContextKeyword​(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.
      • addContextKeywords

        public static void addContextKeywords​(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.
      • removeContextKeyword

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

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

        @Nullable
        public static java.lang.String getOmidPartnerName()
      • setOmidPartnerName

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

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

        public static void setOmidPartnerVersion​(@Nullable
                                                 java.lang.String omidPartnerVersion)