Data Passing

As of the 5.0 SDK release, MoPub provides a 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 (that is, targeting based on the content of the app). Additionally, publishers must not send MoPub any keywords that are against the MoPub Privacy Policies.

Passing Personal Data

As of the 5.0 SDK release, the MoPub SDK exposes an additional keyword API (setUserDataKeywords()) for publishers to send personal data. Publisher Partners must send any demographic or interest-based targeting data (m_age:24) in this field.

Passing Non-Personal Data

You can continue to pass contextual keywords via the setKeywords() API.

Passing Keywords

Pass the keywords from your app to MoPub as a comma-separated list in the ad view. Format each keyword as a key-value pair (for example, m_age:24). You can use any characters except & and =.

Banners and Interstitials

MoPubView moPubView;


Rewarded Videos

import com.mopub.mobileads.MoPubRewardedVideoManager.RequestParameters;

                        new RequestParameters("CONTEXTUAL_KEYWORDS", "USER_DATA_KEYWORDS", "LOCATION", "CUSTOMER_ID"));

Native Ads

import com.mopub.nativeads.RequestParameters;

RequestParameters mRequestParameters;

mRequestParameters = new RequestParameters.Builder()

"YOUR_AD_ADAPTER".loadAds("AD_UNIT_ID", mRequestParameters);

Passing Location

When personal information may be collected, the MoPub Marketplace and certain ad networks can use your user’s location to send more targeted ads. Our SDK will automatically pass over latitude and longitude coordinates if they are available in the app and enabled in the SDK. Specifically, location data will be obtained over GPS on first usage, and then in 10-minute intervals. If there is no GPS location, the last known location will be preserved. Additionally, starting in v5.9.0 of the MoPub SDK, GPS location is prioritized over location data you supply from the app (i.e. when both are available, the MoPub SDK will utilize GPS location).

If you use location in your app, but would like to disable location passing to MoPub, you can do the following:



Using the same key-value pairs, target campaigns using the keyword targeting function in the Advanced Targeting dropdown. To target multiple keywords, use AND (e.g. m_gender:m AND m_age:25). If you want to use the OR clause, separate the keywords by a new line.

Best Practices

When in doubt, you can always call MoPub.canCollectPersonalInformation() to determine if you should be processing any 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.

User Targeting

When you set up line items to serve ads, you can target users whose devices do or do not already have specific apps installed. These must be apps that you own, and you must specify the correct iTunes URL or Android package name in the MoPub UI for both the app and the line for which you want to track conversions. We continue to support app targeting for users who have provided consent in the European Economic Area, United Kingdom, and Switzerland. To leverage this capability, you must select this option in the UI, and add the following code to your SDK integration. (To comply with GDPR, we will not have information about users’ apps for users who have not provided their consent.)

In your main Activity class, place the following snippet in your onCreate() method:

/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {

    //.... other initialization

    // Installed tracking call
    new MoPubConversionTracker().reportAppOpen(this);

This tracking network event only happens once. A preference variable is stored so that the application doesn’t make additional network calls on later app starts.

Last updated November 05, 2019

TWITTER, MOPUB, and the Bird logo are trademarks of Twitter, Inc. or its affiliates. All third party logos and trademarks included are the property of their respective owners.

© 2020 MoPub (a division of Twitter, Inc.)