Integrate myTarget with mediation

This guide shows you how to use the Google Mobile Ads SDK to load and display ads from myTarget using mediation, covering waterfall integrations. It covers how to add myTarget to an ad unit's mediation configuration, and how to integrate the myTarget SDK and adapter into a Flutter app.

Supported integrations and ad formats

Integration
Bidding
Waterfall
Formats
Banner
Interstitial
Rewarded
Rewarded Interstitial
Native

Requirements

  • Latest Google Mobile Ads SDK
  • Flutter 3.7.0 or higher
  • To deploy on Android
    • Android API level 23 or higher
  • To deploy on iOS
    • iOS deployment target of 12.0 or higher
  • A working Flutter project configured with the Google Mobile Ads SDK. See Get Started for details.
  • Complete the mediation Get started guide

Step 1: Set up configurations in myTarget UI

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.

If your app supports both the Android and iOS platforms, you need to set up each one of them separately.

Android

Next, provide the Google Play URL for your app.

iOS

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.

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

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

Update your app-ads.txt

Authorized Sellers for Apps app-ads.txt is an IAB Tech Lab initiative that helps ensure your app ad inventory is only sold through channels you've identified as authorized. To prevent a significant loss in ad revenue, you'll need to implement an app-ads.txt file. If you haven't done so already, set up an app-ads.txt file for your app.

To implement app-ads.txt for myTarget, see How to create and publish a file.

Turn on test mode

Follow the instructions in myTarget's documentation to add and configure a test device in myTarget UI.

Step 2: Set up myTarget demand in AdMob UI

Configure mediation settings for your ad unit

Android

For instructions, see step 2 in the guide for Android.

iOS

For instructions, see step 2 in the guide for iOS.

Add Mail.ru to GDPR and US state regulations ad partners list

Follow the steps in European regulations settings and US state regulations settings to add Mail.ru to the European and US state regulations ad partners list in the AdMob UI.

Step 3: Import the myTarget SDK and adapter

Integration through pub.dev

Add the following dependency with the latest versions of the myTarget SDK and adapter in your package's pubspec.yaml file:

dependencies:
  gma_mediation_mytarget: ^

Manual Integration

Download the latest version of Google Mobile Ads mediation plugin for myTarget, extract the downloaded file, and add the extracted plugin folder (and its contents) to your Flutter project. Then, reference the plugin in your pubspec.yaml file by adding the following dependency:

dependencies:
  gma_mediation_mytarget:
    path: path/to/local/package

Step 4: Implement privacy settings on myTarget SDK

For instructions, see step 4 in the guide for Android and iOS.

Step 5: Add required code

Android

No additional code is required for myTarget integration.

iOS

SKAdNetwork integration

Follow myTarget's documentation to add the SKAdNetwork identifiers to your project's Info.plist file.

Step 6: Test your implementation

Enable test ads

Make sure you register your test device for AdMob and enable test mode in myTarget UI.

Verify test ads

To verify that you are receiving test ads from myTarget, enable single ad source testing in ad inspector using the myTarget (Waterfall) ad source(s).

Error codes

If the adapter fails to receive an ad from myTarget, publishers can check the underlying error from the ad response using ResponseInfo under the following classes:

Android

com.google.ads.mediation.mytarget.MyTargetAdapter
com.google.ads.mediation.mytarget.MyTargetNativeAdapter
com.google.ads.mediation.mytarget.MyTargetRewardedAdapter

iOS

GADMAdapterMyTarget
GADMediationAdapterMyTargetNative
GADMediationAdapterMyTargetRewarded

Here are the codes and accompanying messages thrown by the myTarget adapter when an ad fails to load:

Android

Error code Reason
100 myTarget SDK returned an error.
101 myTarget server parameters configured in the AdMob UI are missing/invalid.
102 The requested ad size does not match a myTarget supported banner size.
103 Ad request is not a Unified native ad request.
104 The loaded native ad from myTarget is different from the requested native ad.
105 The loaded native ad from myTarget is missing some required assets (e.g. image or icon).

iOS

Error code Reason
100 myTarget SDK does not yet have an ad available.
101 myTarget server parameters configured in the AdMob UI are missing/invalid.
102 myTarget Adapter does not support the ad format being requested.
103 Tried to show a myTarget ad that is not loaded.
104 The requested ad size does not match a myTarget supported banner size.
105 Missing required native ad assets.

myTarget Flutter Mediation Adapter Changelog

Version 1.1.0

Version 1.0.0