SDK Privacy Methods
Chartboost requires publishers to obtain consent from their users in order to process personal data and provide relevant ads. Apps under the Google Play Designed for Families policy MUST set the COPPA privacy flag to true. Review our COPPA FAQs for more information on behavior targeting.
Use the addDataUseConsent API to set consent values. This API provides user consent data for privacy laws currently in existence or future laws.
GDPR π
-
/** * GDPR support settings: * NON_BEHAVIORAL(0) means the user does not consent to targeting (Contextual ads) * BEHAVIORAL(1) means the user consents (Behavioral and Contextual Ads) */ val dataUseConsent = GDPR(GDPR.GDPR_CONSENT.BEHAVIORAL) Chartboost.addDataUseConsent(context, dataUseConsent) -
/** * GDPR support settings: * NON_BEHAVIORAL(0) means the user does not consent to targeting (Contextual ads) * BEHAVIORAL(1) means the user consents (Behavioral and Contextual Ads) */ DataUseConsent dataUseConsent = new GDPR(GDPR.GDPR_CONSENT.BEHAVIORAL); Chartboost.addDataUseConsent(context, dataUseConsent);
CCPA π
-
/** * CCPA support settings: * OPT_IN_SALE(1YN-) means the user consents (Behavioral and Contextual Ads) * OPT_OUT_SALE(1YY-) means the user does not consent to targeting (Contextual ads) */ val dataUseConsent = CCPA(CCPA.CCPA_CONSENT.OPT_IN_SALE) Chartboost.addDataUseConsent(context, dataUseConsent) -
/** * CCPA support settings: * OPT_IN_SALE(1YN-) means the user consents (Behavioral and Contextual Ads) * OPT_OUT_SALE(1YY-) means the user does not consent to targeting (Contextual ads) */ DataUseConsent dataUseConsent = new CCPA(CCPA.CCPA_CONSENT.OPT_IN_SALE); Chartboost.addDataUseConsent(context, dataUseConsent);
COPPA π
If an app is child-directed, a value of true or false must be set to define proper behavior.
-
/** * COPPA: * true means that COPPA restrictions apply and the android advertising identifier is not transmitted. (Contextual ads) * false means that COPPA restrictions do not apply. (Behavioral and Contextual Ads) */ val dataUseConsent = COPPA(true) Chartboost.addDataUseConsent(context, dataUseConsent) -
/** * COPPA: * true means that COPPA restrictions apply and the android advertising identifier is not transmitted. (Contextual ads) * false means that COPPA restrictions do not apply. (Behavioral and Contextual Ads) */ DataUseConsent dataUseConsent = new COPPA(true); Chartboost.addDataUseConsent(context, dataUseConsent);
true in order to restrict transmitting the android advertising identifier.
LGPD π
-
/** * LGPD (Brazil's General Data Protection Law): * true means the user allows behavioral targeting (Behavioral and Contextual Ads) * false means the user does not allow behavioral targeting (Contextual ads) */ val dataUseConsent = LGPD(true) Chartboost.addDataUseConsent(context, dataUseConsent) -
/** * LGPD (Brazil's General Data Protection Law): * true means the user allows behavioral targeting (Behavioral and Contextual Ads) * false means the user does not allow behavioral targeting (Contextual ads) */ DataUseConsent dataUseConsent = new LGPD(true); Chartboost.addDataUseConsent(context, dataUseConsent);
Custom Consent π
Chartboost allows publishers to provide custom consent information, besides the predefined GDPR and CCPA values. Custom consent values must be non-empty strings of fewer than 100 characters. Reserved standard names such as gdpr cannot be used as custom privacy standard names.
For example:
-
// customPrivacyStandard: the name of your privacy framework (e.g. "my_framework") // customConsent: the consent value to associate with that standard (e.g. "1") val dataUseConsent = Custom(customPrivacyStandard = "my_framework", customConsent = "1") Chartboost.addDataUseConsent(context, dataUseConsent) -
// First argument: the name of your privacy framework // Second argument: the consent value to associate with that standard DataUseConsent dataUseConsent = new Custom("my_framework", "1"); Chartboost.addDataUseConsent(context, dataUseConsent);
TCF v2.0 π
The TCFv2 class provides a helper to read the IAB TCF v2.0 consent string (IABTCF_TCString) from your appβs default SharedPreferences. This is useful when your CMP writes the TCF string to SharedPreferences and you want to inspect it.
-
val tcfv2 = TCFv2(PreferenceManager.getDefaultSharedPreferences(context)) val tcfString: String? = tcfv2.getTCFString() -
TCFv2 tcfv2 = new TCFv2(PreferenceManager.getDefaultSharedPreferences(context)); String tcfString = tcfv2.getTCFString();
GPP (Global Privacy Platform) π
The GPP class provides helpers to read the IAB GPP consent string (IABGPP_HDR_GppString) and the GPP section ID string (IABGPP_GppSID) from your appβs default SharedPreferences. This is useful when your CMP writes the GPP strings to SharedPreferences and you want to inspect them.
-
val gpp = GPP(PreferenceManager.getDefaultSharedPreferences(context)) val gppString: String? = gpp.getGppString() val gppSid: String? = gpp.getGppSid() -
GPP gpp = new GPP(PreferenceManager.getDefaultSharedPreferences(context)); String gppString = gpp.getGppString(); String gppSid = gpp.getGppSid();
Clear Data Use Consent π
To clear any of the privacy data use consent, use the following method:
-
Chartboost.clearDataUseConsent(context, dataUseConsent.privacyStandard) -
Chartboost.clearDataUseConsent(context, dataUseConsent.getPrivacyStandard());