-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nikolaï Roycourt
committed
Jun 25, 2018
0 parents
commit fccb6df
Showing
13 changed files
with
297 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Teads - iOS MoPub Mediation Adapter | ||
|
||
## Version 4.0.7 | ||
- Updated minimum required Teads SDK to v4.0.7. | ||
- Updated minimum required MoPub SDK to v5.0.0. | ||
- Initial release. Supports interstitials and reward-based video ads. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
# Teads - iOS MoPub Mediation Adapter | ||
> Mediation adapter to be used in conjunction with MoPub to deliver Teads ads on iOS devices. | ||
If you want to display Teads ads in your iOS application through MoPub mediation, you’re at the right place. | ||
|
||
## Requirements | ||
|
||
- ![Platform: iOS 9+](https://img.shields.io/badge/Platform-iOS%209%2B-blue.svg?style=flat) | ||
- ![Xcode: 9.0+](https://img.shields.io/badge/Xcode-9.0+-blue.svg?style=flat) | ||
- ![MoPub SDK: 5.0.0+](https://img.shields.io/badge/MoPub%20SDK-5.0.0+-blue.svg?style=flat) | ||
- ![Teads SDK: 4.0.7+](https://img.shields.io/badge/Teads%20SDK-4.0.7+-blue.svg?style=flat) | ||
|
||
## Features | ||
|
||
- [x] Displaying Teads interstitials | ||
- [x] Displaying Teads rewarded ads | ||
|
||
## Installation | ||
|
||
Before installing Teads adapter, you need to implement [MoPub Ads](https://developers.mopub.com/docs/ios/) in your application. | ||
|
||
### CocoaPods (recommended) | ||
|
||
If your project is managing dependencies through [CocoaPods](https://cocoapods.org/), you just need to add this pod in your `Podfile`. | ||
|
||
**It will install Teads adapter and Teads SDK.** | ||
|
||
1. Add pod named `MoPub-Teads-Adapters` in your Podfile: | ||
|
||
```ruby | ||
platform :ios, '9.0' | ||
pod 'MoPub-Teads-Adapters' | ||
``` | ||
|
||
2. Run `pod install --repo-update` to install the adapter in your project. | ||
3. Follow the [Define Custom Event](#define-custom-event) step to finish the integration. | ||
4. You’re done. | ||
|
||
### Manually | ||
|
||
1. Integrate latest version of Teads SDK to your project using this [Quick Start Guide](http://mobile.teads.tv/sdk/documentation/v4/ios/get-started). | ||
2. Download latest release of [`TeadsMoPubAdapter`](https://github.com/teads/TeadsSDK-adapter-mopub-ios/releases). | ||
3. Drop adapter files in your iOS project. | ||
4. Follow the [Define Custom Event](#define-custom-event) step to finish the integration. | ||
5. You’re done. | ||
|
||
## Documentation | ||
|
||
### Define Custom Event | ||
|
||
In order to display a Teads ad through MoPub mediation, you need to create a [custom SDK network](https://developers.mopub.com/docs/ui/networks/#unsupported-network-setup) on [MoPub dashboard](https://app.mopub.com/networks). | ||
|
||
When creating a custom SDK network, you are required to define these informations: | ||
|
||
| Name | Description | | ||
|-----------------------------|------------------------------------------------| | ||
| `Custom Event Class` | Class name of the adapter | | ||
| `Custom Event Class Data` | JSON configuration for the network | | ||
|
||
1. For `Custom Event Class` parameter, you need to use one of these names depending on ad type: | ||
|
||
- Interstitial ad: `MPAdapterTeadsInterstitial` | ||
- Rewarded ad: `MPAdapterTeadsRewardedVideo` | ||
|
||
2. For the `Custom Event Class Data` parameter, you need to put this JSON settings dictionnary. | ||
|
||
``` | ||
{"PID":"__publisher_PID__"} | ||
``` | ||
|
||
**Important note #1:** Don't forget to replace `__publisher_PID__` with your Teads placement ID. | ||
|
||
### Mediation Settings | ||
|
||
For MoPub rewarded videos, you have the ability to pass [mediation settings](https://developers.mopub.com/docs/ios/rewarded-video/#advanced-mediation-settings) in order to customize third-party ad networks settings. | ||
For Teads, you need to use `TeadsInstanceMediationSettings` class to pass mediation settings. | ||
|
||
**Note**: Only available for rewarded ads. | ||
|
||
1. Create an instance of `TeadsInstanceMediationSettings`. | ||
2. Populate it with your custom settings. | ||
3. Register it into `MPRewardedVideo` using `loadAdWithAdUnitID:withMediationSettings:` method. | ||
4. Teads rewarded ad will receive your specific mediation settings when it will load. | ||
|
||
```swift | ||
// Create mediation settings for Teads rewarded ad | ||
let mediationSettings = TeadsInstanceMediationSettings() | ||
mediationSettings.debugMode = true | ||
mediationSettings.locationDisabled = true | ||
|
||
// Load video | ||
MPRewardedVideo.loadAd(withAdUnitID: adUnitID, withMediationSettings: [mediationSettings]) | ||
``` | ||
|
||
Here is a list of available mediation settings: | ||
|
||
| Settings | Description | | ||
|-----------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| `public var debugMode` | Enable/disable debug logs from Teads SDK. | | ||
| `public var locationDisabled` | Enable/disable collection of user location. By default, SDK will collect user location if corresponding permissions has been granted to the host application. | | ||
| `public var mediaPreloadDisabled` | Enable/disable preload of media files (like videos). If disabled, media files will be loaded lazily. | | ||
| `public var publisherPageUrl` | Sets the publisher page url where ad will be loaded into (for brand safety purposes). | | ||
| `public var lightEndscreen` | Enable/disable light mode for the ad end screen. By default, dark mode is used. | | ||
|
||
## Changelog | ||
|
||
See [CHANGELOG](CHANGELOG.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Versions/Current/Headers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
framework module TeadsMoPubAdapter { | ||
umbrella header "TeadsMoPubAdapter.h" | ||
|
||
export * | ||
module * { export * } | ||
|
||
link framework "Foundation" | ||
link framework "UIKit" | ||
|
||
header "MPAdapterTeadsBanner.h" | ||
header "MPAdapterTeadsConstants.h" | ||
header "MPAdapterTeadsInterstitial.h" | ||
header "MPAdapterTeadsRewardedVideo.h" | ||
header "TeadsInstanceMediationSettings.h" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Versions/Current/TeadsMoPubAdapter |
26 changes: 26 additions & 0 deletions
26
TeadsMoPubAdapter.framework/Versions/A/Headers/MPAdapterTeadsBanner.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// MPAdapterTeadsBanner.h | ||
// TeadsMoPubAdapter | ||
// | ||
// Created by athomas on 30/05/2018. | ||
// Copyright © 2018 Teads. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
#if __has_include(<MoPub/MoPub.h>) | ||
#import <MoPub/MoPub.h> | ||
#elif __has_include(<MoPubSDKFramework/MoPub.h>) | ||
#import <MoPubSDKFramework/MoPub.h> | ||
#else | ||
#import "MPBannerCustomEvent.h" | ||
#endif | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
/// Class adapting Teads banner to work with MoPub mediation. | ||
@interface MPAdapterTeadsBanner : MPBannerCustomEvent | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
29 changes: 29 additions & 0 deletions
29
TeadsMoPubAdapter.framework/Versions/A/Headers/MPAdapterTeadsConstants.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// | ||
// MPAdapterTeadsConstants.h | ||
// TeadsMoPubAdapter | ||
// | ||
// Created by athomas on 29/05/2018. | ||
// Copyright © 2018 Teads. All rights reserved. | ||
// | ||
|
||
#ifndef MPAdapterTeadsConstants_h | ||
#define MPAdapterTeadsConstants_h | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
/// Constants used by Teads adapter. | ||
static NSString * const kTeadsPIDKey = @"PID"; | ||
static NSString * const TeadsAdapterErrorDomain = @"tv.teads.adapter.mopub"; | ||
|
||
/// Enumeration defining possible errors in Teads adapter. | ||
enum { | ||
PIDNotFound, | ||
LoadingFailure | ||
}; | ||
typedef NSInteger TeadsAdapterErrorCode; | ||
|
||
NS_ASSUME_NONNULL_END | ||
|
||
#endif /* MPAdapterTeadsConstants_h */ |
26 changes: 26 additions & 0 deletions
26
TeadsMoPubAdapter.framework/Versions/A/Headers/MPAdapterTeadsInterstitial.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// MPAdapterTeadsInterstitial.h | ||
// TeadsMoPubAdapter | ||
// | ||
// Created by athomas on 28/05/2018. | ||
// Copyright © 2018 Teads. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
#if __has_include(<MoPub/MoPub.h>) | ||
#import <MoPub/MoPub.h> | ||
#elif __has_include(<MoPubSDKFramework/MoPub.h>) | ||
#import <MoPubSDKFramework/MoPub.h> | ||
#else | ||
#import "MPInterstitialCustomEvent.h" | ||
#endif | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
/// Class adapting Teads interstitial to work with MoPub mediation. | ||
@interface MPAdapterTeadsInterstitial : MPInterstitialCustomEvent | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
26 changes: 26 additions & 0 deletions
26
TeadsMoPubAdapter.framework/Versions/A/Headers/MPAdapterTeadsRewardedVideo.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// MPAdapterTeadsRewardedVideo.h | ||
// TeadsMoPubAdapter | ||
// | ||
// Created by athomas on 29/05/2018. | ||
// Copyright © 2018 Teads. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
#if __has_include(<MoPub/MoPub.h>) | ||
#import <MoPub/MoPub.h> | ||
#elif __has_include(<MoPubSDKFramework/MoPub.h>) | ||
#import <MoPubSDKFramework/MoPub.h> | ||
#else | ||
#import "MPRewardedVideoCustomEvent.h" | ||
#endif | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
/// Class adapting Teads rewarded ad to work with MoPub mediation. | ||
@interface MPAdapterTeadsRewardedVideo : MPRewardedVideoCustomEvent | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
49 changes: 49 additions & 0 deletions
49
TeadsMoPubAdapter.framework/Versions/A/Headers/TeadsInstanceMediationSettings.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// | ||
// TeadsInstanceMediationSettings.h | ||
// TeadsMoPubAdapter | ||
// | ||
// Created by athomas on 29/05/2018. | ||
// Copyright © 2018 Teads. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
#if __has_include(<MoPub/MoPub.h>) | ||
#import <MoPub/MoPub.h> | ||
#elif __has_include(<MoPubSDKFramework/MoPub.h>) | ||
#import <MoPubSDKFramework/MoPub.h> | ||
#else | ||
#import "MPMediationSettingsProtocol.h" | ||
#endif | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@class TeadsAdSettings; | ||
|
||
/// Class encapsulating MoPub mediation settings for Teads rewarded ads. | ||
@interface TeadsInstanceMediationSettings : NSObject <MPMediationSettingsProtocol> | ||
|
||
/// Enable test mode | ||
@property (nonatomic, assign) BOOL debugMode; | ||
|
||
/// Disable location reporting | ||
@property (nonatomic, assign) BOOL locationDisabled; | ||
|
||
/// Enable light mode for endscreen | ||
@property (nonatomic, assign) BOOL lightEndscreen; | ||
|
||
/// Disable media preloading | ||
@property (nonatomic, assign) BOOL mediaPreloadDisabled; | ||
|
||
/// Brand safety url | ||
@property (nonatomic, strong) NSString *publisherPageUrl; | ||
|
||
// MARK: - Helpers | ||
|
||
/// Creates an instance of `TeadsAdSettings` configured from mediation settings. | ||
/// - returns: A `TeadsAdSettings` containing settings to configure Teads ads. | ||
- (TeadsAdSettings *)getTeadsAdSettings; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
10 changes: 10 additions & 0 deletions
10
TeadsMoPubAdapter.framework/Versions/A/Headers/TeadsMoPubAdapter.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// | ||
// TeadsMoPubAdapter.h | ||
// TeadsMoPubAdapter | ||
// | ||
// Created by athomas on 30/05/2018. | ||
// Copyright © 2018 Teads. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import <UIKit/UIKit.h> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
A |