Get Started with Avocarrot

Overview

Examples

Android

Overview

- Avocarrot Exchange SDK

Setup Exchange SDK

Stream

Native Assets

Exchange Troubleshooting

- Avocarrot Mediation SDK

Setup Mediation

Stream Ads Mediation

Native ads Mediation

Native Assets Mediation

Banner Mediation

Interstitial Mediation

Video Mediation

Supported Networks & Ad Types

Mediation Troubleshooting

iOS

Overview

- Avocarrot Exchange SDK

Setup SDK

Stream

Native Assets

Exchange Troubleshooting

- Avocarrot Mediation

Getting Started With Mediation

Stream Ads Mediation

Native Ads Mediation

Banner Ads Mediation

Interstitial Ads Mediation

Video Ads Mediation

Supported Networks & Ad Types

Mediation Troubleshooting

API Documentation

Reporting API

Help

FAQ

Updates

SDK Change Log

Android Change Log

iOS Change Log

Getting Started With Mediation

Updated a month ago ​by Chris

Overview

This tutorial helps you enable the Mediation feature and start serving ads to your iOS apps from third-party ad networks including the Avocarrot exchange.  

Prerequisites

Before you can integrate mediation, you need an Avocarrot account to complete the tutorial.  Create an account.

Please note that if you are an existing Ampiri publisher and migrating from Ampiri SDK v4.x to Avocarrot SDK v4.x, you should consult our migration guide here.

Initialization

Avocarrot iOS SDK supports iOS 8.0 or higher.

You can add AvocarrotSDK to your project using Cocoapods  (recommended) or manually

You should add only the 3rd party ad networks that you already use or plan to use them in your mediation waterfall. You can have a look on the supported ad networks and their ad types here.  
Note: If you don’t have pods in your project, set them up using the Getting Started guide

From version 4.5 Avocarrot SDK uses modular system to distribute based on subspecs:

  • By default, Avocarrot SDK pod provides SDK with our native assets ad format only, add pod ‘avocarrot-ios-sdk’ to your Podfile to integrate it to your project

Banners

  • If you want to use the Avocarrot banners with server-side mediated networks only, add pod ‘avocarrot-ios-sdk/Banner’ to your Podfile

  • If you want to use the Avocarrot banners with all server-side mediated networks including client side SDKs, add pod ‘avocarrot-ios-sdk/BannerAdapters’ to your Podfile

  • For Banners, If you want to select which client networks SDK to be included with server side mediated networks, refer to the pods specified below to add into your Podfile:

    • pod 'avocarrot-ios-sdk/BannerAdapters/FBAudienceAdapter' - Avocarrot banners and adapter for Facebook Audience banners
    • pod 'avocarrot-ios-sdk/BannerAdapters/GoogleMobileAdsAdapter' - Avocarrot banners and adapter for Google Mobile Ads SDK banners
    • pod 'avocarrot-ios-sdk/BannerAdapters/MopubAdapter'- Avocarrot banners and adapter for MoPub banners
    • pod 'avocarrot-ios-sdk/BannerAdapters/InLocoAdapter' - Avocarrot banners and adapter for InLoco banners

Interstitials

  • If you want to use the Avocarrot interstitials with server-side mediated networks only, add pod ‘avocarrot-ios-sdk/Interstitial’ to your Podfile

  • If you want to use the Avocarrot interstitials with all server-side mediated networks including client side SDKs, add pod ‘avocarrot-ios-sdk/InterstitialAdapters’ to your Podfile

  • For Interstitials, if you want to select which client networks SDK to be included with server side mediated networks, refer to the pods specified below to add into your Podfile:

    • pod 'avocarrot-ios-sdk/InterstitialAdapters/FBAudienceAdapter' - Avocarrot interstitials and adapter for Facebook Audience interstitials
    • pod 'avocarrot-ios-sdk/InterstitialAdapters/GoogleMobileAdsAdapter' - Avocarrot interstitials and adapter for Google Mobile Ads SDK interstitials
    • pod 'avocarrot-ios-sdk/InterstitialAdapters/MopubAdapter' - Avocarrot interstitials and adapter for MoPub interstitials
    • pod 'avocarrot-ios-sdk/InterstitialAdapters/ChartboostAdapter' - Avocarrot interstitials and adapter for Chartboost interstitials
    • pod 'avocarrot-ios-sdk/InterstitialAdapters/NativeXAdapter' - Avocarrot interstitials and adapter for NativeX interstitials
    • pod 'avocarrot-ios-sdk/InterstitialAdapters/AppLovinAdapter' - Avocarrot interstitials and adapter for AppLovin interstitials
    • pod 'avocarrot-ios-sdk/InterstitialAdapters/InLocoAdapter' - Avocarrot interstitials and adapter for InLoco interstitials

Videos

  • If you want to use the Avocarrot videos with server-side mediated networks, only add pod 'avocarrot-ios-sdk/Video' to your Podfile

  • If you want to use the Avocarrot videos with all server-side mediated networks including client side SDKs, add pod ‘avocarrot-ios-sdk/VideoAdapters’ to your Podfile

  • For videos, if you want to select which client networks SDK to be included with server side mediated networks, refer to the pods specified below to add into your Podfile:

    • pod 'avocarrot-ios-sdk/VideoAdapters/ChartboostAdapter' - Avocarrot banners and adapter for Chartboost videos
    • pod 'avocarrot-ios-sdk/VideoAdapters/NativeXAdapter' - Avocarrot banners and adapter for NativeX videos
    • pod 'avocarrot-ios-sdk/VideoAdapters/UnityAdsAdapter' - Avocarrot banners and adapter for Unity Ads videos
    • pod 'avocarrot-ios-sdk/VideoAdapters/VungleAdapter'- Avocarrot banners and adapter for Vungle videos
    • pod 'avocarrot-ios-sdk/VideoAdapters/AdColonyAdapter' - Avocarrot banners and adapter for AdColony videos

Rendered native ads

  • If you want to use the Avocarrot native views with server-side mediated networks only, add pod 'avocarrot-ios-sdk/NativeView' to your Podfile

  • If you want to use the Avocarrot native views with all server-side mediated networks including client side SDKs, add pod ‘avocarrot-ios-sdk/NativeViewAdapters’ to your Podfile

  • For native views, if you want to select which client networks SDK to be included with server side mediated networks, refer to the pods specified below to add into your Podfile:

    • pod 'avocarrot-ios-sdk/NativeViewAdapters/FBAudienceAdapter' - Avocarrot native views and adapter for Facebook Audience native views
    • pod 'avocarrot-ios-sdk/NativeViewAdapters/GoogleMobileAdsAdapter' - Avocarrot native views and adapter for Google Mobile Ads SDK native views
    • pod 'avocarrot-ios-sdk/NativeViewAdapters/MopubAdapter' - Avocarrot native views and adapter for MoPub native views
    • pod 'avocarrot-ios-sdk/NativeViewAdapters/AppLovinAdapter' - Avocarrot native views and adapter for AppLovin native views
    • pod 'avocarrot-ios-sdk/NativeViewAdapters/InLocoAdapter' - Avocarrot native views and adapter for InLoco native views

Warning: Avocarrot SDK 4.5.0 was designed and verified to work correctly with the following versions of 3rd party ad network SDKs:

  • AdColony – 3.1.1
  • Chartboost – 6.6.3
  • Google Mobile Ads – 7.20.0
  • NativeX – 5.5.9
  • Unity Ads – 2.1.0
  • Vungle – 4.1.0
  • Facebook Audience – 4.23.0
  • MoPub – 4.14.0
  • AppLovin – 3.1
  • Baidu - 4.5
  • Tencent - 4.5.4
  • InLoco - 2.4.4

Note: The Baidu and Tencent ad network adapters and SDKs must be added to your project manually and are not included in the Cocoapods distribution.


From version 4.5 Avocarrot SDK uses modular system for distribution, the complete package contains these frameworks:

FrameworkDescription
AvocarrotCore.frameworkCore functionality; provides access to main SDK settings
AvocarrotBanner.frameworkProvides access to banner ads
AvocarrotInterstitial.frameworkProvides access to interstitial ads
AvocarrotVideo.frameworkProvides access to video ads
AvocarrotNativeAssets.frameworkProvides access to raw native data
AvocarrotNativeView.frameworkProvides access to rendered native ads
Vast.frameworkImplementation of VAST
Mraid.frameworkImplementation of MRAID

1. Add SDK files to your project (required)

Required frameworks for each ad type:

Ad typeFrameworks
BannersAvocarrotCore.frameworkAvocarrotBanner.frameworkMraid.framework
InterstitialAvocarrotCore.frameworkAvocarrotInterstitial.frameworkMraid.framework
VideoAvocarrotCore.frameworkAvocarrotVideo.frameworkVast.framework
Native assetsAvocarrotCore.frameworkAvocarrotNativeAssets.framework
Stream Ads
(Native view/ rendered Native ad)
AvocarrotCore.frameworkAvocarrotNativeAssets.framework,AvocarrotNativeView.frameworkVast.framework

Add needed files to your project.

To show standard banner ads from client-side mediated networks in your application you need to add:

To show interstitial ads from client-side mediated networks in your application you need to add:

To show video ads from client-side mediated networks in your application you need to add:

To show native ads from client-side mediated networks in your application you need to add:

Warning: Avocarrot SDK 4.5.0 was designed and verified to work correctly with the following versions of 3rd party ad network SDKs:

  • AdColony – 3.1.1
  • Chartboost – 6.6.3
  • Google Mobile Ads – 7.20.0
  • NativeX – 5.5.9
  • Unity Ads – 2.1.0
  • Vungle – 4.1.0
  • Facebook Audience – 4.20.2
  • MoPub – 4.14.0
  • AppLovin – 3.1
  • Baidu - 4.5
  • Tencent - 4.5.4
  • InLoco - 2.4.4

We do not guarantee stable and correct behaviour of the Avocarrot SDK if you manually add other versions of ad network SDKs.

3. Add SDK external adapters to your project

For each added external ad network from the section above you should add the SDK adapter for this network for each ad type from the Adapters folder. Just add the necessary adapters to the project.


AdColony:

Ad typeAdapters
VideolibAVOAdColonyAdapter-Video.a


Chartboost:

Ad typeAdapters
InterstitiallibAVOChartboostAdapter-Core.alibAVOChartboostAdapter-Interstitial.a
VideolibAVOChartboostAdapter-Core.alibAVOChartboostAdapter-Video.a

Google Mobile Ads:

Ad typeAdapters
BannerslibAVOGoogleMobileAdsAdapter-Core.alibAVOGoogleMobileAdsAdapter-Banner.a
InterstitiallibAVOGoogleMobileAdsAdapter-Core.alibAVOGoogleMobileAdsAdapter-Interstitial.a
Native view (rendered native ad)libAVOGoogleMobileAdsAdapter-Core.alibAVOGoogleMobileAdsAdapter-Native.a


NativeX:

Ad typeAdapters
InterstitiallibAVONativeXAdapter-Core.alibAVONativeXAdapter-Interstitial.a
VideolibAVONativeXAdapter-Core.alibAVONativeXAdapter-Video.a


Unity Ads:

Ad typeAdapters
VideolibAVOUnityAdsAdapter-Video.a


Vungle:

Ad typeAdapters
VideolibAVOVungleAdapter-Video.a


Facebook Audience:

Ad typeAdapters
BannerslibAVOFBAudienceAdapter-Core.alibAVOFBAudienceAdapter-Banner.a
InterstitiallibAVOFBAudienceAdapter-Core.alibAVOFBAudienceAdapter-Interstitial.a
Native view (rendered native ad)libAVOFBAudienceAdapter-Core.alibAVOFBAudienceAdapter-Native.a


MoPub:

Ad typeAdapters
BannerslibAVOMopubAdapter-Core.alibAVOMopubAdapter-Banner.a
InterstitiallibAVOMopubAdapter-Core.alibAVOMopubAdapter-Interstitial.a
Native view (rendered native ad)libAVOMopubAdapter-Core.alibAVOMopubAdapter-Native.a


AppLovin:

Ad typeAdapters
InterstitiallibAVOAppLovinAdapter-Core.alibAVOAppLovinAdapter-Interstitial.a
Native view (rendered native ad)libAVOAppLovinAdapter-Core.alibAVOAppLovinAdapter-Native.a


Baidu:

Ad typeAdapters
BannerslibAVOBaiduAdapter-Core.alibAVOBaiduAdapter-Banner.a
InterstitiallibAVOBaiduAdapter-Core.alibAVOBaiduAdapter-Interstitial.a
Native view (rendered native ad)libAVOBaiduAdapter-Core.alibAVOBaiduAdapter-Native.a


Tencent:

Ad typeAdapters
BannerslibAVOTencentAdapter-Banner.a
InterstitiallibAVOTencentAdapter-Interstitial.a
Native view (rendered native ad)libAVOTencentAdapter-Native.a


InLoco:

Ad typeAdapters
BannerslibAVOInLocoAdapter-Core.alibAVOInLocoAdapter-Banner.a
InterstitiallibAVOInLocoAdapter-Core.alibAVOInLocoAdapter-Interstitial.a
Native view (rendered native ad)libAVOInLocoAdapter-Core.alibAVOInLocoAdapter-Native.a

4. Set up external networks

You should set up each added external network on the Avocarrot dashboard, otherwise they will not be used for showing ads.

5. Add -ObjC flag to project settings (Other Linker Flags property)

Note: If your app can’t use -ObjC flag just add -force_load $(PROJECT_DIR)/Pods/avocarrot-ios-sdk/AvocarrotSDK.framework/Versions/Current/AvocarrotSDK flag to Other Linker Flags

6. Required system libraries for all libs

The SDK with adapters uses the following system frameworks and libraries. You can set flag “Link Frameworks automatically” to YES otherwise you should add following system frameworks and libraries to your project manually:

  • WebKit
  • Security
  • QuickLook
  • MobileCoreServices
  • CoreText
  • AssetsLibrary
  • Foundation
  • CoreData
  • Social
  • MessageUI
  • MediaPlayer
  • EventKit
  • EventKitUI
  • QuartzCore
  • CoreMedia
  • CFNetwork
  • SystemConfiguration
  • CoreGraphics
  • StoreKit
  • CoreTelephony
  • AVFoundation
  • AdSupport
  • AudioToolbox
  • UIKit
  • libxml2
  • libsqlite3
  • libz

Warning: Some Xcode versions support new settings only after the Xcode reboot. This also cleans the Xcode cache and remedies other problems.

TO DO list if you have a linking problem:

  • Clean Build
  • Restart Xcode
  • Delete your DerivedData folder in ~/Library/Developer/Xcode/DerivedData
  • Restart the computer

ATS settings in iOS 9.0 and greater

Since the Avocarrot SDK uses 3rd party networks to load ads and we have no control over these networks loading their content via https, you should disable ATS for your application to ensure the Avocarrot SDK behaves as intended. To disable ATS add the following settings to your application Info.plist file:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key><true/>
    <key>NSAllowsArbitraryLoadsForMedia</key><true/>
    <key>NSAllowsArbitraryLoadsInWebContent</key><true/>
    </dict>

Next Steps

Choose an ad format

You're ready to implement an ad. Avocarrot Mediation offers a number of ad formats, so you can choose the one that best fits your app's user experience.


Was this article useful?