GDPR

Need to know

Before getting started with this section, make sure that you have read the Quick Guide on GDPR to understand the flow of events that you will be implementing below.

We added an additional field for publishers to send personal data. Publisher Partners must send any demographic or interest-based targeting data in the fields designated for such data, as described below. Publisher Partners must not include any personal data, including demographic or interest-based targeting data, in any fields intended for contextual targeting (i.e., targeting based on the content of the app).

Check for GDPR applicability

If we detect that a user opened a given application for the first time in the European Economic Area, United Kingdom, or Switzerland, as determined by the user’s truncated IP address, MoPub will consider GDPR applying to that user for the lifetime of that application, meaning that MoPub requires the user’s consent before serving personalized ads. This version of the SDK does not currently support consent from users located outside of where we have determined GDPR applies and you should not pass consent state for users outside of these regions. If you are passing a consent state for users that MoPub has determined are located outside of the Europoean Econimc Area, the United Kingdom, or Switzerland, MoPub will disregard the consent state, as the SDK will not treat GDPR as applying to users outside of these regions, and we will continue to process their personal data.

Once the SDK has been initialized, call MoPub.IsGdprApplicable. You will get back a bool indicating whether GDPR applies to the user.

If GDPR applies, proceed to ask your user for an explicit consent. You can collect the consent from your users using either of the options below.

If you get an unknown answer, ensure that the SDK has been initialized.

MoPub-owned Consent

Details

The consent dialog will not load if you attempt to call it for a user that MoPub has determined is outside of the European Economic Area, the United Kingdom, or Switzerland. Please keep this in mind when testing outside of those regions

The consent dialog will default to the user’s device language if it is set to Deutsch, English, Español, Français, Italiano, Nederlands, or Português. If the user’s device is not set to one of those 7 languages, the dialog will default to English. Additionally, the user will have the ability to select the dialog’s language. For more information on the consent dialog, see our FAQ.

Example

Check if you should show the consent dialog:

MoPub.ShouldShowConsentDialog{get}

Start loading the consent dialog. This call is no-op if the user has opted out of ads personalization.

MoPub.LoadConsentDialog();

Note: Consent Dialogue will not load successfully if you are trying to request the dialogue when MoPub.isGDPRApplicable is false.

If you have subscribed to listen to events, in the OnConsentDialogLoadedEvent callback, show the consent dialog that the SDK has prepared for you.

If you choose to show the consent dialog at some point in the future, check if it is ready via IsConsentDialogLoaded before showing it.

If your consent dialog fails to load, you will be notified via OnConsentDialogFailedEvent() with the error code, at which point you can choose to load it again later.

Publisher-owned Consent

SDK v 5.0 does not currently support consent from users located outside of where we have determined GDPR applies and you should not pass consent state for users outside of these regions. If you are passing a consent state for users that MoPub has determined are located outside of the Europoean Econimc Area, the United Kingdom, or Switzerland, MoPub will disregard the consent state, as the SDK will not treat GDPR as applying to users outside of these regions, and we will continue to process their personal data.

Disclaimer

Only specific (managed) publishers who have been given permission are able to use their own consent dialog. If you attempt to use the API without approval, we will not collecting personal data even for users that have provided consent. Please contact your account manager for further assistance.

Enable Consent Mechanism Outside EU regions

As of 5.1+, publishers will be able to determine which users should be treated as GDPR compliant through the API ForceGdprApplicable. For additional details, check here.

Set the language

You can optionally set a language of choice (a 2-character ISO 639-1 String) for your vendor list and privacy policy when constructing your consent dialog, like so:

MoPub.ConsentLanguageCode="en";

Access this to get the current vendor list link:

Uriurl=MoPub.PartnerApi.CurrentVendorListUrl;

Access this to get the current privacy policy link:

Uriurl=MoPub.PartnerApi.CurrentConsentPrivacyPolicyUrl;

Then, depending on whether the user has given consent, call one of the below methods to let the MoPub SDK know:

// Call this to let MoPub know the user has granted consentMoPub.PartnerApi.GrantConsent();// Call this to let MoPub know the user has revoked consent.MoPub.PartnerApi.RevokeConsent();

(Optional) Below is a list of methods you could use in addition to the above APIs:

// Get the current consent status. The possible statuses can be found in the MoPub.Consent.Status enumMoPub.Consent.StatusMoPub.CurrentConsentStatus{get}// Listen to the consent status change. You will have access to the old status, the new status, and a boolean for whether you can continue to collect personal informationMoPubEventListener.OnConsentStatusChanged(oldStatus,newStatus,canCollectPii)// Additional methods for current/consented vendors and privacy policy. Always reference `PartnerApi` for the most recent APIs.stringMoPub.PartnerApi.CurrentConsentIabVendorListFormat{get}stringMoPub.PartnerApi.CurrentConsentPrivacyPolicyVersion{get}stringMoPub.PartnerApi.CurrentConsentVendorListVersion{get}stringMoPub.PartnerApi.PreviouslyConsentedIabVendorListFormat{get}stringMoPub.PartnerApi.PreviouslyConsentedPrivacyPolicyVersion{get}stringMoPub.PartnerApi.PreviouslyConsentedVendorListVersion{get}

Best Practices

You have the option to use, MoPub.CanCollectPersonalInfo to determine whether the user has provided consent for MoPub and its partners to process personal data. If you are using MoPub mediation, adapters have already been modified to let the mediated SDKs know whether they, too, can collect and process users’ personal data.

Keywords API

For purposes of GDPR compliance, if you are not on SDK version 5.0+. you should not target interest or demographic keywords in the European Economic Area, United Kingdom, and Switzerland. Additionally, MoPub will block interest and demographic keywords when the user does not have consent in these regions.

The MoPub SDK exposes an additional keyword API (userDataKeywords) for publishers to send demographic (e.g, age or gender) or interests data for ad targeting. You must send any demographic or interest-based targeting data in this field.

You can continue passing contextual keywords (i.e., targeting based on the content of the app) via the keywords API. You must not include any personal data, including demographic or interest-based targeting data, in this field.