- Passing Personal Data
- Passing Non-Personal Data
- Passing Keywords
- Passing Location
- Frequency Capping ID
- Best Practices
- User Targeting
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 (
userDataKeywords) 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
Pass the keywords from your app to MoPub as a comma-separated list in the ad view as follows:
Enter keywords as key-value pairs.
A key-value pair is a set of two linked data items: the first is a key, which is a unique identifier for the item of data, and the second item is the value. Each pair is denoted as
key:value. Here is an example of a key-value pair for keywords:
Enter each key-value pair as its own String, and each String must be comma-separated.
You can use any characters except
Keep to a maximum length of 10K characters.
To target multiple keywords, use
AND. For example:
m_gender:m AND m_age:25
To use the
ORclause, separate the keywords by a new line. For example:
To negatively target a property, put a
-in front of the keyword. For example:
To target a set of values for one keyword, pass each value with the keyword individually.
For example, this only matches line items that target all three values–apple, banana, orange:
fruit:apple AND fruit:banana AND fruit:orange
To negatively target a set of values for one keyword, use the
For example, here we exclude a line item from being served when the ad request contains the keyword ‘fruit’ with the values set to ‘apple’, ‘bananas’, or ‘oranges’:
-fruit:apple AND -fruit:banana AND -fruit:oranges
Banners and Interstitials
MPAdView *adView = [[MPAdView alloc] initWithAdUnitId:@"AD_UNIT_ID" size:MOPUB_BANNER_SIZE]; adView.delegate = self; adView.keywords = @"CONTEXTUAL_KEYWORDS"; adView.userDataKeywords = @"USER_DATA_KEYWORDS"; [adView loadAd];
[MPRewardedVideo loadRewardedVideoAdWithAdUnitID:self.info.ID keywords:@"CONTEXTUAL_KEYWORDS" userDataKeywords:@"USER_DATA_KEYWORDS" location:nil customerId:@"CUSTOMER_ID" mediationSettings:@];
MPNativeAdRequestTargeting *targeting = [[MPNativeAdRequestTargeting alloc] init]; targeting.keywords = @"CONTEXTUAL_KEYWORDS"; targeting.userDataKeywords = @"USER_DATA_KEYWORDS"; ["YOUR_AD_PLACER" loadAdsForAdUnitID:self.adInfo.ID targeting:targeting]
When personal information may be collected, the MoPub Marketplace and certain ad networks can use your user’s location to send more targeted ads. If your app already has location permissions (based on your obtaining appropriate consent from the end user), the MoPub SDK will automatically attempt to acquire location data for ad requests. 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 use, 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 (that is, when both are available, the MoPub SDK will use GPS location).
To opt out of this functionality, use
MoPub.h. The MoPub SDK will never prompt the user for permission if location permissions are not currently granted.
You can also choose to pass the location yourself by passing any
MPAdView, which will forward what you supply to the location property down to the underlying ad network.
Using the same key-value pairs described in the Passing Keywords section, target campaigns using the keyword targeting function in the Advanced Targeting dropdown.
Frequency Capping ID
In MoPub SDK versions 4.9+, MoPub automatically passes a rotating identifier for devices using iOS10 or later that have elected to limit ad tracking. This identifier is used solely to provide MoPub-internal frequency capping, while respecting the change in Apple’s IDFA practices. To disable this feature, use
When in doubt, you can always call
[[MoPub sharedInstance] canCollectPersonalInfo] 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.
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 item 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.)
MPAdConversionTracker.h file in your application delegate, and place the following line in
[[MPAdConversionTracker sharedConversionTracker] reportApplicationOpenForApplicationID:@"<ITUNES_APPLICATION_ID>"];
Last updated March 06, 2020
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.)