- Passing Personal and Non-Personal Data
- Passing Keywords
- Passing Location
- Frequency Capping ID
- Best Practices
- User Targeting
As of the 5.0 SDK release, MoPub provides an option 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 and Non-Personal Data
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.
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 described below.
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.
Official (Reserved) Keywords
Age, gender, and year of birth are the only three values for which MoPub has assigned official keywords. Use the API for user data keywords (
userDataKeywords) to pass these three fields.
m_age:use to pass age
m_gender:use to pass gender
m_yob:use to pass year of birth
For any other keywords or data, you may pass them for your business use (such as line-item targeting). The MoPub ad server will not attempt to extract meaningful data from them as a result.
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
Targeting a range is not supported at this time. If you pass a lower-bound and an upper-bound
m_agevalue (for example,
m_age:28 OR m_age:29) to the
keywordsfield, MoPub only calculates based on the first
m_agethat we see.
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];
[MPRewardedAds loadRewardedAdWithAdUnitID:self.info.ID keywords:@"CONTEXTUAL_KEYWORDS" userDataKeywords:@"USER_DATA_KEYWORDS" 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]
After iOS 14
iOS 14 enables the user to control the precision collected about their location. Starting with MoPub SDK v.5.14, we no longer use our own SDK to pass user location, nor do we collect the location information from the publisher. We now collect the location data from Apple at the granularity specified by the user. Refer to Apple documentation for details about location access to your app.
Before iOS 14
When personal information may be collected, MoPub Marketplace 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 automatically attempts to acquire location data for ad requests. Our SDK automatically passes latitude and longitude coordinates if they are available in the app and enabled in the SDK. Specifically, location data is obtained over GPS on first use, and then in 10-minute intervals. If there is no GPS location, the last known location is preserved. Additionally, starting with v5.9.0 of the MoPub SDK, GPS location is prioritized over the location data you supply from the app (that is, when both are available, the MoPub SDK uses GPS location).
In MoPub SDK v.5.13 and lower, you can opt out of this functionality by using
MoPub.h. The MoPub SDK will never prompt the user for permission if location permissions are not currently granted. This API is deprecated starting with MoPub SDK v.5.14.
In MoPub SDKs v.5.12 and lower, 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. This option is removed starting with MoPub SDK v.5.13.0.
Using the same key-value pairs described in the Passing Keywords section, target campaigns using the keyword targeting function in the Advanced Targeting dropdown.
Targeting After iOS 14
For platforms prior to iOS 14, MoPub collects device identifiers for tracking purposes by fetching the IDFA. With iOS 14, starting with MoPub SDK for iOS v.5.14, MoPub fetches the IDFA if it is available; in its absence, MoPub tracks using the IDFV; and in the absence of both, MoPub uses a MoPub-specific device identifier.
The MoPub device identifier is generated by MoPub and, unlike the IDFA, it is meaningful only within the MoPub system. In the absence of both an IDFA and IDFV, we use this MoPub device ID for frequency capping and rate limiting.
Frequency Capping ID
In MoPub SDK versions 4.9+, MoPub automatically passes a MoPub-generated identifier for devices using iOS10+ that have opted 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. 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>"];
How can we make this article better for you?
Last updated March 30, 2021
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.
© 2021 MoPub (a division of Twitter, Inc.)