Data Passing

Need to know

As of the 5.0 SDK release, MoPub provides a field for publisher 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). Additionally, publishers should not send MoPub any keywords that are against the MoPub Privacy Policies.

New in 5.0

  • Personal data passing: The MoPub SDK now 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.

  • Non-personal data passing: Contextual keywords can continue to be passed via the setKeywords() API.

Passing Keywords

Pass the keywords from your app to MoPub as a comma-separated list in the ad view. Each keyword should be formatted as a key/value pair (e.g. m_age:24). Any characters can be used except & and =.

Banners and interstitials

MoPubView moPubView;

moPubView.setAdUnitId("AD_UNIT_ID");
moPubView.setKeywords("CONTEXTUAL_KEYWORDS");
moPubView.setUserDataKeywords("USER_DATA_KEYWORDS");
moPubView.loadAd();

Rewarded Videos

import com.mopub.mobileads.MoPubRewardedVideoManager.RequestParameters;

MoPubRewardedVideos.loadRewardedVideo("AD_UNIT_ID",
                        new RequestParameters("CONTEXTUAL_KEYWORDS", "USER_DATA_KEYWORDS", "LOCATION", "CUSTOMER_ID"));

Native ads

import com.mopub.nativeads.RequestParameters;

RequestParameters mRequestParameters;

mRequestParameters = new RequestParameters.Builder()
                        .location(location)
                        .keywords("CONTEXTUAL_KEYWORDS")
                        .userDataKeywords("USER_DATA_KEYWORDS")
                        .desiredAssets(desiredAssets)
                        .build();

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

Passing Location

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 available in the app and enabled in the SDK.

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

MoPub.setLocationAwareness(MoPub.LocationAwareness.DISABLED);

Targeting

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.

Last updated May 31, 2018

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.

© 2018 MoPub Inc.