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 Android app.

Supported formats and features

The Ad Manager mediation adapter for myTarget has the following capabilities:

Formats
Banners
Interstitials
Rewarded video
Rewarded Video (new APIs)
Native Ad - Custom Rendering
Features
Smart banners
Automatic Data Collection
Native Video

Requirements

  • Android SDK 4.0 (API level 14) or later
  • Google Play services 17.2.0 or later

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 Google Play 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 Ad Manager 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. Navigate to the Profile tab and select Access Tokens. Click Create Token or Show Token to view your MyTarget Permanent Access Token.

Step 2: Configure mediation settings for your Ad Manager ad unit

Sign in to your Ad Manager account. Navigate to Delivery > Yield groups and click the New yield group button.

Enter a unique Name for your yield group, set the Status to Active, select your Ad Format, and set the Inventory type to Mobile App. Under the Targeting > Inventory section, select the Ad Unit ID to which you want to add mediation.

Next, click the Add yield partner button.

If you already have a Yield partner for myTarget, you can simply select it. Otherwise, select Create a new yield partner.

Select myTarget as the Ad network and enter a unique Name. Enable Mediation and turn on Automatic data collection, and enter the Permanent Access Token obtained in the previous section. You don't need to enter a Username and Password. Click Save when done.

Once the Yield partner is selected, choose Mobile SDK mediation as the Integration type, Android as the Platform, and Active as the Status. Enter the Slot ID obtained in the previous section and a Default CPM value.

Click Save at the bottom of the page when 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 Override reward settings from third-party ad networks when using mediation box.

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

Step 3: Import the myTarget SDK and adapter

Add the following implementation dependencies with the latest versions of the myTarget SDK and adapter in the app-level build.gradle file:

...
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'com.google.android.gms:play-services-ads:18.3.0'
    implementation 'com.google.ads.mediation:mytarget:5.4.6.0'
}
...

Manual integration

Download the latest version of myTarget Android SDK and add it to your project.

Download the latest .aar file of the adapter from Bintray and add it to your project.

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 Ad Manager 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 5.1.0 , myTarget added a user consent API. The following sample code sets user consent to true 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.

MyTargetPrivacy.setUserConsent(true);

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

MyTargetPrivacy.setUserAgeRestricted(true);

See myTarget’s GDPR Guide for more information.

Using native ads

Ad rendering

The myTarget adapter returns its native ads as UnifiedNativeAd objects.

The myTarget adapter populates the following fields for a UnifiedNativeAd.

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
Logo Not guaranteed
Advertiser Always
MyTarget SDK always returns 0 for mediaview width and height, so the MyTarget Adapter always returns 0 for getMediaContent().getAspectRatio(). The MyTarget SDK will fix this issue in a future release.

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.

myTarget Android Mediation Adapter Changelog

Version 5.5.5.0

  • Verified compatibility with myTarget SDK version 5.5.5.
  • Updated the minimum required Google Mobile Ads SDK version to 18.3.0.

Built and tested with:

  • Google Mobile Ads SDK version 18.3.0.
  • MyTarget SDK version 5.5.5.

Version 5.4.6.0

  • Verified compatibility with myTarget SDK version 5.4.6.
  • Updated the minimum required Google Mobile Ads SDK version to 18.2.0.

Version 5.4.5.0

  • Verified compatibility with myTarget SDK version 5.4.5.
  • Updated the minimum required Google Mobile Ads SDK version to 18.1.0.

Version 5.4.0.0

  • Verified compatibility with myTarget SDK version 5.4.0.

Version 5.3.9.1

  • Added support for flexible banner ad sizes.

Version 5.3.9.0

  • Verified compatibility with myTarget SDK version 5.3.9.
  • Updated adapter to support new open-beta Rewarded API.
  • Updated the minimum required Google Mobile Ads SDK version to 17.2.0.

Version 5.3.6.0

  • Verified compatibility with myTarget SDK version 5.3.6.

Version 5.2.5.0

  • Verified compatibility with myTarget SDK version 5.2.5.
  • Fixed a bug where the adapter fails to request a Banner ad when using a custom size.

Version 5.2.2.0

  • Verified compatibility with myTarget SDK version 5.2.2.

Version 5.2.1.0

  • Verified compatibility with myTarget SDK version 5.2.1.

Version 5.2.0.0

  • Verified compatibility with myTarget SDK version 5.2.0.

Version 5.1.4.0

  • Verified compatibility with myTarget SDK version 5.1.4.

Version 5.1.3.0

  • Verified compatibility with myTarget SDK version 5.1.3.

Version 5.1.2.0

  • Verified compatibility with myTarget SDK version 5.1.2.

Version 5.1.1.0

  • Verified compatibility with myTarget SDK version 5.1.1.

Version 5.1.0.1

  • Updated adapter to use the Unified Native Ads adapter API.

Version 5.1.0.0

  • Verified compatibility with myTarget SDK version 5.1.0.

Version 5.0.4.0

  • Verified compatibility with myTarget SDK version 5.0.4.

Version 5.0.2.1

  • Updated the adapter to make it compatible with Google Mobile Ads SDK version 15.0.0.

Version 5.0.2.0

  • Verified compatibility with myTarget SDK version 5.0.2.

Version 5.0.0.0

  • Verified compatibility with myTarget SDK version 5.0.0.
  • Updated the adapter to make it compatible with myTarget SDK 5.0.0 and Android Studio 3.1.

Version 4.7.2.0

  • Verified compatibility with myTarget SDK version 4.7.2.

Version 4.7.1.0

  • Verified compatibility with myTarget SDK version 4.7.1.
  • Added support for video and carousel ads inside MediaView.

Version 4.6.28.0

  • Updated the adapter project for Android Studio 3.0.
  • Verified compatibility with myTarget SDK version 4.6.28.

Version 4.6.27.0

  • First release!
  • Added support for banner, interstitial, rewarded, and native ads.