Integrating myTarget with Mediation

This guide is intended for publishers who want to use the Google Mobile Ads SDK to load and display ads from myTarget via mediation. It covers how to add myTarget to an ad unit's mediation configuration, and how to integrate the myTarget SDK and adapter into an iOS app.

Supported formats and features

The AdMob mediation adapter for myTarget has the following capabilities:

Formats
Banners
Interstitials
Rewarded video
Native Advanced
Features
Smart banners
Ad Network Optimization
Native Video

Requirements

  • Xcode 7.0 or higher.
  • iOS Deployment target of 7.0 or higher.
  • Minimum required Google Mobile Ads SDK 7.14.0 or higher.

Step 1: Set up the myTarget network

First, sign up or log in to your myTarget account. Navigate to the Apps page by clicking on APPS on the header. Add your app by clicking ADD APP.

Next, provide the iTunes URL for your app.

When adding an app, myTarget requires you to create an ad unit before you can complete the process.

Banner

Select BANNER from the available ad formats, and then click the ADD AD UNIT button.

Interstitial

Select INTERSTITIAL from the available ad formats, and then click the ADD AD UNIT button.

Rewarded Video

Select REWARDED VIDEO from the available ad formats, and then click the ADD AD UNIT button.

Native

Select NATIVE from the available ad formats, and then click on ADD AD UNIT.

In your ad unit's details page, make a note of your slot ID which can be found under the ad unit settings as slot_id. This slot ID will be used to set up your AdMob ad unit in the next section.

In addition to the slot_id, you'll also need your MyTarget Permanent Access Token to set up your AdMob ad unit ID. This Permanent Access Token is used when sending requests to the myTarget API. See Generating the access token for myTarget for more information.

Step 2: Configure mediation settings for your AdMob ad unit

You need to add myTarget to the mediation configuration for your ad unit. First sign in to your AdMob account.

Next, navigate to the Mediation tab. If you have an existing mediation group you'd like to modify, click the name of that mediation group to edit it, and skip ahead to Add myTarget as an ad source.

To create a new mediation group, select Create Mediation Group.

Enter your Ad Format and Platform, then click Continue.

Give your mediation group a name, and select locations to target. Next, set the mediation group status to Enabled, and then click Add Ad Units.

Associate this mediation group with one or more of your existing AdMob ad units. Then, click Done.

You should now see the ad units card populated with the ad units you selected as shown below:

Add myTarget as an ad source

In the Ad Sources card, select Add Ad Network.

Enable the Optimize switch, enter the Permanent Access Token obtained in the previous section and enter an eCPM value for MyTarget to set up ANO for MyTarget. Click Continue to continue with to the next step.

Enter the slot ID obtained in the previous section and click Done.

Using rewarded video ads

In the settings for your rewarded video ad unit, provide values for the reward amount and reward type. Then, to ensure you provide the same reward to the user no matter which ad network is served, check the Apply to all networks in Mediation groups box.

If you don't apply this setting, the myTarget adapter defaults to a reward of type "" (empty string) with a value of 1.

For more information on setting reward values for AdMob ad units, see Create an ad unit.

Step 3: Import the myTarget SDK and adapter

  • Add the following line to your project's Podfile:

    pod 'GoogleMobileAdsMediationMyTarget'
    
  • From the command line run:

    pod install --repo-update

Manual integration

  • Download the latest version of the myTarget SDK.
  • Download the latest version of the myTargetAdapter, and link MyTargetAdapter.framework in your project.
  • Add the following frameworks to your project:
    • CoreLocation
    • CoreTelephony
    • CoreMedia
    • SystemConfiguration
    • StoreKit
    • AdSupport
    • SafariServices
    • AVFoundation

Step 4: Additional code required

No Additional code is required for myTarget Integration.

Step 5: Test your implementation

When testing, myTarget recommends using the slot IDs from its open source example app to request ads. These can be entered as the slot ID for your AdMob ad units for testing purposes, and then replaced with an actual slot ID when your app is ready for production.

Optional steps

Under the Google EU User Consent Policy, you must ensure that certain disclosures are given to, and consents obtained from, users in the European Economic Area (EEA) regarding the use of device identifiers and personal data. This policy reflects the requirements of the EU ePrivacy Directive and the General Data Protection Regulation (GDPR). When seeking consent, you must identify each ad network in your mediation chain that may collect, receive, or use personal data and provide information about each network's use. Google currently is unable to pass the user's consent choice to such networks automatically.

The section below shows you how to enable or disable personalized ads for myTarget.

In myTarget SDK version 4.7.9, myTarget added a user consent API. The following sample code sets user consent to YES on the myTarget SDK. If you choose to call this method, it is recommended that you do so prior to requesting ads via the Google Mobile Ads SDK.

#import <MyTargetSDK/MyTargetSDK.h>
// ...

[MTRGPrivacy setUserConsent:YES];

Additionally, if the user is known to be in an age-restricted category, you can use the setUserAgeRestricted: method.

[MTRGPrivacy setUserAgeRestricted:YES];

See myTarget’s GDPR Guide for more information.

Network-specific parameters

The myTarget adapter supports isDebugMode, an optional extra to enable logging which has a default value of YES. This parameter can be passed to the adapter using the GADMAdapterMyTargetExtras class and must be set on every ad request. Here's how to set it:

Swift

let request = GADRequest()
let extras = GADMAdapterMyTargetExtras()
extras.isDebugMode = false
adRequest.register(extras)

Objective-C

GADRequest *request = [GADRequest request];
GADMAdapterMyTargetExtras * extras = [[GADMAdapterMyTargetExtras alloc] init];
extras.isDebugMode = NO;
[request registerAdNetworkExtras:extras];

Using native ads

Ad rendering

The myTarget adapter returns its native ads as either NativeAppInstallAd or NativeContentAd objects.

The myTarget adapter populates the following fields for a GADNativeAppInstallAd.

Field Populated by myTarget adapter
Headline Always
Image Always
Body Always
App icon Always
Call to action Always
Star rating Not guaranteed
Store Not guaranteed
Price Not guaranteed

The myTarget adapter populates the following fields for a GADNativeContentAd.

Field Populated by myTarget adapter
Headline Always
Image Always
Body Always
Logo Not guaranteed
Call to action Always
Advertiser Always

Impression and click tracking

The Google Mobile Ads SDK uses the myTarget SDK's callbacks for impression and click tracking, so the reports from both sources should match up with few to no discrepancies.

Send feedback about...

Google Mobile Ads SDK for iOS
Google Mobile Ads SDK for iOS
Need help? Visit our support page.