Vungle FAQs | Comparably
Vungle Claimed Company
Vungle is an application monetization platform through video advertisements for game developers. read more
EMPLOYEE
PARTICIPANTS
20
TOTAL
RATINGS
231

Vungle FAQs

Vungle's Frequently Asked Questions page is a central hub where its customers can always go to with their most common questions. These are the 74 most popular questions Vungle receives.

Frequently Asked Questions About Vungle

  • Use this guide to add VungleiOS SDK into yourapp, usingMoPub as yourmain advertising mediation layer. MoPub iOS adapter 6.4.6.0 is compatible with Vungle iOS SDK 6.4.6.

    Download Vungle iOS SDK 6.4.6

    Download MoPub iOS Adapter 6.4.6.0

    Contents

    Before You Begin

    Step 1. Set Up Vungle as a Network

    Set Up Vungle as an SDK Network

    Set Up Vungle as a Custom Native Network

    Step 2. Add Vungle as a Third-Party Ad Network

    Optional Advanced Settings

    Early SDK Initialization

    Memory Settings

    Restrict IDFV Collection

    Rewarded Ads Customization

    Interstitial Ads Customization

    Before You Begin

    The Vungle iOS adapter 6.4.6.0 has been tested with MoPub iOS SDK 5.10.0.

    The MoPub Dashboard does not yet include Vungle placements; check your placement-level performance using our Reporting API for Publishers.

    MoPub must be set up in your app before starting this tutorial. For a step-by-step guide, refer to MoPubs Getting Started Guide for iOS.

    Refer to our MoPub integration documentation on integrating MoPub with your app.

    Interstitial: https://developers.mopub.com/docs/ios/interstitial/

    Rewarded Video: https://developers.mopub.com/docs/ios/rewarded-video/

    Banner: https://developers.mopub.com/publishers/ios/banner/

    Set up the application with the right XCode and iOS SDK version as detailed in the Vungle iOS integration document.

    Step 1. Set Up Vungle as an SDK Network or as a Custom Native Network

    Set Up Vungle as an SDK Network

    Log in to the MoPub dashboard and select Networks from the main navigation panel.

    Click New Network. here and select Vungle.

    In the Network Settings section, if you Enable reporting access, enter your Reporting API Key from the Vungle Dashboard.

    In App & Ad Unit Setup, enter the Vungle Application ID and Placement Reference IDs.

    Set Up Vungle as a Custom Native Network

    To ensure that the MoPub servers recognize the integrated Vungle Adapters, set up Vungle as a Custom Native Network in the MoPub dashboard.

    Log into the MoPub dashboard, and navigate to Networks by the main navigation bar.

    Click New Network button on the top right. and select Vungle from the list.

    After creating Vungle as a Network, click on the name from the list of Networks. In the Set Up Your Inventory section, for each ad unit that will use the Vungle SDK to present video ads, ensure that the MoPub SDK can find the network adapter used to interact with the Vungle SDK:

    If you are using MoPub Rewarded Video for an Ad Unit, add VungleRewardedVideoCustomEvent under the Custom Event Class section.

    If you are using Interstitial for an Ad Unit, add VungleInterstitialCustomEvent under the Custom Event Class.

    If you are using MREC for an Ad Unit, add VungleBannerCustomEvent under the Custom Event Class.

    Add your Vungle App ID, placement reference ID of the placement to be called from the ad unit, and all placement reference IDsin JSON format under the Custom Event Class Data.

    Set the placement reference ID you want to link to the MoPub Ad Unit for pid.

    Make sure to link a placement that is set to rewarded type at Vungle dashboard to the MoPub Ad Unit that is set to Rewarded Video; and link a placement that is set to interstitial type at Vungle dashboard to the MoPub Ad Unit that is set to Fullscreen (320 x 480).

    {

    "appId":"59208865950e6d380100001f",

    "pid":"DEFAULT07430"

    }

    Note:The Vungle SDK will cache an ad automatically for the placement selected to be Cache Optimized in the Vungle Dashboard. Please reach out to your Account Manager for more information.

    Step 2. Add Vungle as a Third-Party Ad Network

    To add the Vungle iOS SDK into your app using MoPub mediation:

    Add all the Vungle-related adapter files to /AdNetworkSupport/Vungle/and make sure to include .m files in the project'sBuild Phases Compile Sources.

    VungleAdapterConfiguration.h

    VungleAdapterConfiguration.m

    VungleBannerCustomEvent.h

    VungleBannerCustomEvent.m

    VungleInstanceMediationSettings.h

    VungleInstanceMediationSettings.m

    VungleInterstitialCustomEvent.h

    VungleInterstitialCustomEvent.m

    VungleRewardedVideoCustomEvent.h

    VungleRewardedVideoCustomEvent.m

    VungleRouter.h

    VungleRouter.m

    Copy the VungleSDK.framework folder into /AdNetworkSupport/Vungle/SDK/.

    Make sure the project's Build Settings Framework Search Path includes the framework. For example:

    $(PROJECT_DIR)/AdNetworkSupport/Vungle/SDK/VungleSDK.framework

    Make sure the framework is included in the project's Build Phases Link Binary With Libraries.

    Follow the instructions in the Add Other Required Frameworks section of Get Started with Vungle - iOS SDK to add the necessary frameworks.

    Follow the instructions in the Add the -ObjC Linker Flag sectionof Get Started with Vungle - iOS SDK toadd the linker flag.

    Follow the instructions in the Remove the iOS Status Bar sectionof Get Started with Vungle - iOS SDK toremove the status bar.

    Call the MPInterstitialAdControllers showFromViewController method (or, for rewarded ads, call the MPRewardedVideo's presentRewardedVideoAdForAdUnitID method) when you want to present a Vungle video ad! (No need to call the Vungle iOS SDK methods directly. The MoPub SDK will do it.)

    Optional Advanced Settings

    Early SDK Initialization (Recommended)

    MoPub iOS SDK 5.5.0 and above allows you to early initialize ad network SDK when MoPub SDK completes initialization. We strongly recommend you to use this feature as it will allow additional time for Vungle SDK to pre-cache an ad and have it ready to play at display opportunity.

    Sample code:

    MPMoPubConfiguration * sdkConfig = [[MPMoPubConfiguration alloc]

    initWithAdUnitIdForAppInitialization:@"MOPUB_AD_UNIT_WITH_VUNGLE_PLACEMENT"];

    NSMutableDictionary *configDictionary = [NSMutableDictionary dictionaryWithDictionary:@{ @"appId" : @"YOUR_VUNGLE_APP_ID" }];

    [sdkConfig setNetworkConfiguration:configDictionary forMediationAdapter:@"VungleAdapterConfiguration"];

    [[MoPub sharedInstance] initializeSdkWithConfiguration:sdkConfig

    completion:^{ NSLog(@"SDK initialization complete");

    }];

    Memory Settings

    Starting from v6.4.0, you can prevent the SDK from downloading, requesting ads or even initializing if the storage of your iOS device falls below a predefined threshold.

    These are the option keys available:

    Keys

    Type/Value

    Description

    vngMinSpaceForInit

    Integer, value in MB, default value is 50

    Sets the required minimum available free storage space to be able to initialize the SDK

    vngMinSpaceForAdLoad

    Integer, value in MB, default value is 50

    Sets the required minimum available free storage space to be able to request an ad

    Sample code:

    NSMutableDictionary *configDictionary = [NSMutableDictionary dictionaryWithDictionary:@{ @"appId" : @"YOUR_VUNGLE_APP_ID" }];

    [[NSUserDefaults standardUserDefaults] setValue:@(50) forKey:@"vngMinSpaceForInit"];

    [[NSUserDefaults standardUserDefaults] setValue:@(50) forKey:@"vngMinSpaceForAdLoad"];

    [sdkConfig setNetworkConfiguration:configDictionary forMediationAdapter:@"VungleAdapterConfiguration"];

    Restrict collection of IDFV

    Starting with iOS SDK 6.4.3, publishers can now restrict from passing IDFV when Limit Ad Tracking option is enabled on user's devices.

    Sample code:

    [VungleRouter.sharedRouter setShouldCollectDeviceId:NO];

    Rewarded Ads Customization

    You can use VungleInstanceMediationSettings to customize rewarded ad experience.

    These are the option keys available:

    Keys

    Type/Value

    Description

    orientations

    0

    Auto-rotate

    1

    Landscape

    2

    Portrait

    Sets the orientation of the ad. We recommend allowing ads to auto-rotate, even if your app is in portrait. This way, the user has the option to watch full-size videos, resulting in a better user experience. You can achieve this by setting the orientation on a view controller level (rather than a project level).

    ordinal

    Integer

    If you receive ordinal data reports from Vungle, use this field to pass the mediation ordinal. This is an integer indicating the order in which this ad was shown in the game session (for example, if two ads were already shown in this session, and this ad from Vungle was then shown third, pass in 3). Read more about ordinal data here.

    startMuted

    YES or NO

    The Vungle SDK instance offers the option to play ads with the sound disabled.Please contact your account manager to enable it from Vungle dashboard as well.

    userIdentifier

    String

    Sets your user ID. The value is passed to Vungle server, and then sent to your server through server-to-server callback system if a placement is set to "Rewarded."

    Interstitial Ads Customization

    Starting with MoPub adapter 6.4.5.1, you can uselocalExtras to pass customization options for interstitial ads.

    These are the option keys available:

    Keys

    Type/Value

    Description

    orientations

    NSNumber

    0

    Auto-rotate

    1

    Landscape

    2

    Portrait

    Sets the orientation of the ad. We recommend allowing ads to auto-rotate, even if your app is in portrait. This way, the user has the option to watch full-size videos, resulting in a better user experience. You can achieve this by setting the orientation on a view controller level (rather than a project level).

    ordinal

    NSString

    If you receive ordinal data reports from Vungle, use this field to pass the mediation ordinal. This is an integer indicating the order in which this ad was shown in the game session (for example, if two ads were already shown in this session, and this ad from Vungle was then shown third, pass in 3). Read more about ordinal data .

    muted

    NSNumber

    YES or NO

    The Vungle SDK instance offers the option to play ads with the sound disabled.Please contact your account manager to enable it from Vungle dashboard as well.

    Sample code:

    NSNumber *orientations = [NSNumber numberWithInt:1];

    NSString *ordinal = @"10";

    NSNumber *muted = [NSNumber numberWithBool:YES];

    NSDictionary *localExtras = @{@"ordinal" : ordinal ?: @"",

    @"muted" : muted ?: @"",

    @"orientations" : orientations ?: @""};

    self.interstitial.localExtras = localExtras;

    View Article
  • Use this guide to add VungleiOS SDK into yourapp, usingAdMob as yourmain advertising mediation layer.AdMob iOS adapter v6.4.6.0 is compatible with Vungle iOS SDK v6.4.6 and has been tested with Google SDK v7.52.0

    Download AdMob iOS Adapter v6.4.6.0 and include Vungle SDK, then add them to your project manually.

    Vungle iOS SDK is also available through CocoaPods. Add the following line in your project's pod file followed by aquick pod install runto update the project with the version of Vungle iOS SDK.

    pod "VungleSDK-iOS", "6.4.6"

    Contents

    Before you get Started

    Setup

    Ad Format

    IDFV

    Memory Settings

    New Rewarded API

    Before YouGet Started

    Ad units set up on AdMob dashboard.

    Vungle App ID and Placement IDs created on Vungle dashboard and placement IDs are linked to ad units on AdMob dashboard.

    Set up the application with the right Xcode and iOS SDK version as detailed in the Vungle iOS integration document

    Use this document as a supplement documentation for information that is not available from AdMob's Integrating Vungle with Mediation guide.

    Setup

    Before you begin to test the new adapter-

    Integrate the application with the latest adapter files(v6.4.6.0) and Vungle SDK(v6.4.6).

    Update the Google Mobile Ads SDK to the latest version in the project.

    Ad Format

    v6.4.x supports AdMobs banner ads for MREC size (300 x 250) only.

    To display banner ad in the application, create an MREC placement on Vungle dashboard and link this placement to a Banner Ad unit on AdMob dashboard. Presently, Vungle supports banner size 300x250 and should be specified as kGADAdSizeMediumRectangle as ad constant size in the implementation.

    Sample Code:

    //Create a Banner view of type kGADAdSizeMediumRectangle

    GADBannerView *bannerView = [[GADBannerView alloc] initWithAdSize:kGADAdSizeMediumRectangle];

    [self addBannerViewToView:self.bannerView];

    Loading, playing and closing the banner ad is detailed in the AdMob integration guide.

    IDFV

    For SDK version 6.4.x onwards, publishers can now restrict from passing IDFV from the device to the SDK.

    Sample Code:

    //Set the bool value YES to pass the IDFV from device to SDK

    [VungleRouterConfiguration setPublishIDFV:YES];

    //Set the bool value NO to disable the IDFV collection from device to SDK

    [VungleRouterConfiguration setPublishIDFV:NO];

    Memory Settings

    Starting from v6.4.x, you can prevent the SDK from requesting ads or even initializing if the storage of your iPhone falls below a predefined threshold.

    Sample Code:

    //Integer value sets the required minimum available free storage space to be able to initialize the SDK

    [VungleRouterConfiguration setMinSpaceForInit:];

    //Integer value sets the required minimum available free storage space to be able to request an Ad

    [VungleRouterConfiguration setMinSpaceForAdLoad:];

    New Rewarded API

    As documented by AdMob, starting from version 7.42.2 or higher, AdMobs Rewarded Ads (New APIs), lets you cache multiple ads at the same time for a single ad unit.

    Since Vungle does not support this feature, the Ad request for the second Load ad will not be filled by Vungle, rather it will be passed to the next ad network in the waterfall.

    View Article
  • The sizes below reflectwhat is shown in the device settings once the app is installed.

    Version

    An empty app with just a play button

    An app with the Vungle SDK and a play button

    An app with the Vungle SDK + Google Play Services*

    iOS SDK

    v. 6.4.6

    Size: 156 KB

    Size: 1.6 MB

    Android SDK

    v. 6.4.11 - ProGuard Enabled

    Size:2.98 MB

    Size: 6.46 MB

    Size:7.54 MB

    Method Count: 7371

    Method Count: 14571

    Method Count: 16883

    v. 6.4.11 - ProGuard Disabled

    Size:7.38 MB

    Size: 9.96 MB

    Size: 12.91MB

    Method Count: 17489

    Method Count: 22760

    Method Count: 29390

    Windows SDK

    v. 6.4.1

    Size: 8 KB

    Size:9.32 MB

    * Selective compilation of play-services-ads-identifier:16.0.0,play-services-basement:16and play-services-location:16.

    ** This number is increased by third-party dependencies. The core Vungle SDK 6.3.24 alone has around 830 methods. Actual method count increase may be less depending on the overlapping third-party dependencies.

    View Article
  • Contents

    GDPR: Recommended Implementation

    Before You Begin

    Step 1. Update build.settings

    Step 2. Add the Code

    GDPR Recommended Implementation

    As of May 25th, the General Data Protection Regulation (GDPR) will be enforced in the European Union. To comply with GDPR, developers have two options.

    Option 1 (recommended): Publisher controls the GDPR consent process at the user level, then communicates the users choice to Vungle. To do this, developers can collect the users consent using their own mechanism, and then use Vungle APIs to update or query the users consent status. Refer to the GDPR Recommended Implementation Instructions section for details.

    Option 2: Allow Vungle to handle the requirements. Vungle will display a consent dialog before playing an ad for a European user, and will remember the users consent or rejection for subsequent ads.

    Before You Begin

    We recommend that you use the latest Corona build for your integration. The latest Vungle Corona plugin v. 6.3.0 has Vungle Android SDK v. 6.3.24 and iOS SDK v. 6.3.2.

    Corona SDK version2018.3326 and above is integrated with Vungle Plugin version 6.3.0

    The Vungle Corona Plugin for iOS supports iOS 8 and above.

    The Vungle Corona Plugin for Android supports Android 4.0.3 (Ice Cream Sandwich - API version 15) and above, limited by the Corona SDK.

    The Vungle Corona Plugin for Android supports Amazon OS 5.4 and above, added starting with the daily build 2017.3124.

    Download our sample app: https://github.com/Vungle/Corona-Plugin/tree/master

    Step 1: Update build.settings

    Add the following entry into the plugins table inbuild.settings. When added, the SDK will connect to the server to integrate the Vungle SDK 5+ plugin during the build phase:

    plugins ={

    ["plugin.vungle"] = {

    publisherId = "com.vungle", }, ..}

    For Android Only

    For Android, the following permissions are automatically added when using this plugin:

    android = {

    usesPermissions = {

    "android.permission.INTERNET",

    "android.permission.WRITE_EXTERNAL_STORAGE",

    android.permission.ACCESS_NETWORK_STATE,

    },

    },

    After adding Google Play Services, add below permissions into AndroidManifest. Vungle uses these information to tailor the best ad available for the user.

    android = {

    usesPermissions = {

    "android.permission.ACCESS_COARSE_LOCATION",

    "android.permission.ACCESS_FINE_LOCATION",

    },

    },

    IMPORTANT: If you are developing with Corona Enterprise, you must include Android Support Library v4 for the integration to be successful.

    Step 2: Add the Code

    Initialize the SDK

    We recommend that you initialize the SDK as soon as your app launches to allow the SDK enough time to download ad assets for the auto-cached placement. Initializing the SDK requires:

    Importing Vungle ads

    Vungle app ID

    Placement reference IDs for all the placements you will be using in your app

    You can find these IDs on the Vungle Dashboard (refer to Setting Up and Reporting on Placements ). For the Amazon platform, use the Amazon Application ID from your Vungle Dashboard.

    Sample code:

    local ads = require "plugin.vungle"

    platform = system.getInfo( "platformName" )

    if (platform == "Android") then

    appData = { appID="ANDROID_APP_ID", placement1 = "ANDROID_PLACEMENT_REFERENCE_ID_1", placement2 = "ANDROID_PLACEMENT_REFERENCE_ID_2", placement3 = "ANDROID_PLACEMENT_REFERENCE_ID_3" }

    else if (platform == "Amazon") thenappData = { appID="AMAZON_APP_ID", placement1 = "AMAZON_PLACEMENT_REFERENCE_ID_1", placement2 = "AMAZON_PLACEMENT_REFERENCE_ID_2", placement3 = "AMAZON_PLACEMENT_REFERENCE_ID_3" }else appData = { appID="IOS_APP_ID", placement1 = "IOS_PLACEMENT_REFERENCE_ID_1", placement2 = "IOS_PLACEMENT_REFERENCE_ID_2", placement3 = "IOS_PLACEMENT_REFERENCE_ID_3" }

    end

    -- vungleAdListner is optional

    ads.init("vungle", appData.appID, vungleAdListener)

    Once the SDK is initialized successfully, it calls the following event:

    event.type == "adInitialize"

    After the Vungle SDK is initialized, it automatically requests an ad for the placement you selected as Auto-Cached in the Vungle Dashboard. We recommend selecting the most viewed placement for auto-caching.

    Once an ad is cached successfully, the adAvailable event is called with the placement reference ID matching your Auto-Cached placement. The SDK will keep requesting an ad for the auto-cached placement.

    Load an Ad for a Placement

    For placements other than the auto-cached placement call the ads.load() method to load an ad. It takes a placement reference ID string as an argument and attempts to load an ad for that particular placement only when ads.load() is issued and ad is not available for that placement:

    ads.load(appData.placement1)

    Note: This method is only used for placements other than the auto-cached one, because auto-cached ads are loaded immediately after playing the pre-cached ad.

    Play an Ad for a Placement

    After allowing enough time for the download of ad assets to complete, you can play the ad by calling ads.show(). You should check whether there is an ad ready for this placement by calling event.adPlayble before attempting to play an ad.

    Sample code:

    if (event.placementID == appData.placement1) then

    if (event.adPlayable == true) then

    ads.show( { placementId = appData.placement1 } )

    end

    end

    Event Handling

    You can pass optional event listeners to ads.init() by setting up the listener before the initialization takes place. Below is the list of event listeners available.

    adStarttype: adStartplacementID: placement reference IDisError: true if an ad could not be played; false if an ad started playing

    adLogtype: adLogmessage: ad activity message

    adInitializetype: adInitialize

    adAvailabletype: adAvailableplacementID: placement reference IDisAdPlayable: true if an ad is available to played; false otherwise

    adEndtype: adEndplacementID: placement reference IDdidDownload: true if the user clicked the download button; false otherwisecompletedView: true if the user watched 80% or more of the video; false otherwise

    vungleSDKlog type: vungleSDKlogmessage: SDK event message

    Sample code:

    local function vungleAdListener( event )

    if ( event.type == "adStart" and not event.isError ) then

    -- adStart event is called and ad will play

    end

    if ( event.type == "adStart" and event.isError ) then

    -- Ad has not finished caching and will not play

    end

    if ( event.type == "adLog") then

    -- adLog event is called to pass ad activity information

    end

    if ( event.type == "adInitialize") then

    -- adInitilizaed is called when placement has successfully initialized

    end

    if ( event.type == "adAvailable" ) then

    -- adAvailable is called when playability changes to/from true/false

    -- Usage example: setting a flag to true when download completes

    -- Check event.placementID and event.isAdPlayable to set a flag to true

    -- Then check this flag later in your app and play an ad when it is true

    end

    if ( event.type == "adEnd" ) then

    -- adEnd is called when the end card is closed and and control is return to the hosting app

    end

    if ( event.type == "vungleSDKlog" ) then

    -- vungleSDKlog is called when logging event from SDK takes place

    end

    end

    Customization Options

    The ads.show() method can accept an options dictionary to customize the ad play experience.

    Key

    Value

    Description

    alertTitle

    alertText

    alertContinue

    placement

    String

    You can customize a message to display to users when they attempt to close the incentivized video before completion. (Rewardedads are in some cases referred to asincentivizedads; both terms always refer to the same kind of ad. In the SDK code and in our Reporting API, we use the term 'incentivized'.)

    Note: This setting only applies to standard Vungle ads. For Dynamic Template ads, the same customization is available on the Dashboard.

    isAutoRotation

    Bool

    For Android, if true (default), the video ad will rotate automatically with the device's orientation. If false, it will use the ad's preferred orientation.

    For iOS, refer to the orientation key below.

    isSoundEnabled

    Bool

    If true (default), sound will be enabled during video ad playback, subject to the device's sound settings. If false, video playback will begin muted. Note that the user can mute or unmute sound during playback.

    immersive

    Bool

    For Android only, enables or disables immersive mode on KitKat+ devices.

    large

    Bool

    For iOS only, draws larger buttons that control ad functions such as mute or close.

    orientation

    Integer

    For iOS only, set to 4 for landscape, 0 for portrait, or 5 to rotate automatically.

    userTag

    String

    Set your user ID to reward the user for watching rewarded ads.

    ordinal

    String

    Set ordinal data that tracks how many ads have been shown in a session. Custom reports available upon request.

    flexCloseSec

    Integer

    Automatically closes Flex-View ads after specified time in seconds.

    Sample code:

    if (platform == "Android") then

    options = {

    placementId = placement1,

    isAutoRotation = isAutoRotate,

    immersive = isImmersive,

    isSoundEnabled = not isMuted

    }

    else

    options = {

    placementId = placement1,

    large = large.isOn,

    isSoundEnabled = not muted.isOn

    }

    endoptions.userTag = "USER_ID"if (not isempty(alertTitle.text)) then

    options.alertTitle = alertTitle.text

    end

    if (not isempty(alertText.text)) then

    options.alertText = alertText.text

    end

    if (not isempty(alertClose.text)) then

    options.alertClose = alertClose.text

    end

    if (not isempty(alertContinue.text)) then

    options.alertContinue = alertContinue.text

    end

    if (not isempty(placement.text)) then

    options.placement = placement.text

    end

    ads.show(options)

    GDPR Recommended Implementation Instructions

    To use Vungle APIs to update or query the users consent status (as recommended in Option 1 of Vungle's GDPR: Recommended Implementation ),use the functions as suggested below.

    The first parameter specifies whether the user has opted in to (1) or out of (2) the message being displayed by the publisher. The second parameter (for plugin version 6.3.0 and above) indicates the publisher-controlled consent policy version, which enables the publisher to ask for consent again when the GDPR policy changes by pooling users by the message version.

    // To set user's consent status to opted in (plugin version 6.3.0 and above):

    vungle.updateConsentStatus(1, "corona consent v1.0")

    //To set user's consent status to opted in (plugin version below 6.3.0):

    vungle.updateConsentStatus(1)

    // To set the user's consent status to opted out (plugin version 6.3.0 and above):

    vungle.updateConsentStatus(2, "corona consent v1.0")

    // To set the user's consent status to opted out (plugin version below 6.3.0):

    vungle.updateConsentStatus(2)

    // To find out what the user's current consent status is (plugin version 6.3.0 and above):

    local consentStatus consentStatus = vungle.getConsentStatus()

    //To get the current consent message version use the below API (plugin version 6.3.0 and above):

    //If the version is not not found, nil is returned

    consentVersion.text = vungle.getConsentMessageVersion()

    View Article
  • AdMob Android adapter 6.5.0.0 is compatible with Vungle Android SDK 6.5.0. Documentation forintegrating AdMob Mediation with Vungle SDK (Android) resides on AdMob's Guide section, Integrating Vungle with Mediation.

    Download AdMob Android Adapter v6.5.0.0 and include Vungle Android SDK 6.5.0, then add them to your project manually. Or you can do Gradle integration through JCenter.

    implementation 'com.vungle.early-access:publisher-sdk-android:6.5.0'

    The instructions for Android Studio integration and manual integration can be found on AdMob's integration guide, Step 3: Import the Vungle SDK and Adapter, at https://developers.google.com/admob/android/mediation/vungle#step_3_import_the_vungle_sdk_and_adapter.

    Use this guide as a supplement toAdMob's integration documentation as it has information about new features that are are yet to be covered by the official documentation. AdMob Android adapter 6.5.0 is compatible with Vungle Android SDK 6.5.0 and is tested for compatibility with Google SDK 18.2.0

    If you are updating to Vungle Android SDK v6 using the Google Mobile Ads SDK, you must use Google Play Services Ads 12.0.0 or higher because we have added theonRewardedVideoCompleted() callback method to RewardedVideoAdListener. For more information, refer to the Google Mobile Ads SDK Release Notes.

    Ad Format

    Starting with v6.5.0, Vungle SDK supports AdMobs banner ads in 3 sizes.To display a banner ad in the application, create an MREC or banner placement on Vungle dashboard and configure this to a banner ad unit on AdMob dashboard.

    Supported banner sizes:

    Size in dp (WxH)

    Description

    AdSize constant

    320x50

    Banner

    BANNER

    728x90

    IAB Leaderboard

    LEADERBOARD

    300x250

    IAB Medium Rectangle

    MEDIUM_RECTANGLE

    AdMob allows publishers to use same ad unit ID in multiple places at the same time but Vungle SDK supports only one instance of Banner for a given AdMob ad unit ID at any given time. Please do not attempt to use same Vungle Banner placement reference ID in multiple AdMob ad unit ID since adapter is not designed to handle such case and will lead to unexpected behavior. If you wish to have multiple Vungle Banner instances simultaneously at a given time using Vungle AdMob adapter, we would advise you to create separate ad unit IDs, pointing to different Vungle placements within one Vungle app ID.

    Sample code:

    AdView adView = new AdView(this);adViews.add(adView);adView.setAdSize(AdSize.MEDIUM_RECTANGLE);adView.setAdUnitId(<AdUnit>);

    Network Specific Parameters

    The Vungle AdMob adapter continues to support network specific parameters and v6.4.11 and above will support an additional parameter setAutoRotateEnabled(bool) to play the ad as per device orientation.

    Sample code:

    Bundle extras = new VungleExtrasBuilder(placements) .setSoundEnabled(false) .setUserId("test_user") .setAutoRotateEnabled(true) .build();AdRequest request = new AdRequest.Builder() .addNetworkExtrasBundle(VungleAdapter.class, extras) // Rewarded video. .addNetworkExtrasBundle(VungleInterstitialAdapter.class, extras) // Interstitial. .build();

    Memory Settings

    Starting with v6.4.11, you can prevent the SDK from requesting ads or even initializing if the storage of your Android phone falls below a predefined threshold. If this happens, you will get an error similar to the following:

    There is not enough file system size on the device.

    Sample code:

    import com.vungle.mediation.VungleNetworkSettings;

    //Integer value sets the required minimum available free storage space to be able to initialize the SDKVungleNetworkSettings.setMinSpaceForInit(<INTEGER_VALUE>);//Integer value sets the required minimum available free storage space to be able to request an adVungleNetworkSettings.setMinSpaceForAdLoad(<INTEGER_VALUE>);

    Android ID

    Starting with v6.4.11, publishers can now restrict from passing Android ID from the device to the SDK.

    Sample code:

    VungleNetworkSettings.setAndroidIdOptOut(true);

    New Rewarded API

    As documented in AdMob instruction guide, v17.2.0 and higher supports caching multiple rewarded ads at the same time.Since Vungle does not support this feature,the ad request for the second load attempt won't be filled by Vungle, rather it will be passed to the next ad network in the waterfall.

    We recommend that you use cache optimized placement if you want to have more than one ad cached since ad request will be automatically made at the time of ad play, then next ad is highly likely to be ready to be played by the time previous ad experience ends.

    View Article
  • Before You Begin

    Requirements

    Android 4.0 (Ice Cream Sandwich - API version 14 and above

    Amazon OS 5.4 and above

    In-Feed and MREC ads requires API version 16 and above

    Migrated to AndroidX on Android SDK 6.5.0

    Java Doc

    https://vungle.github.io/vungle-android-sdk/javadoc/index.html

    Sample App

    https://github.com/Vungle/Android-SDK/tree/6.5.0-early-access

    Step 1. Include the Vungle SDK in Your Project

    The Vungle SDK is available in two ways: as an AAR via Maven, or JAR integration.

    Option 1. Gradle Integration

    Open the project-level build.gradle, and ensure that the JCenter details are as below.

    allprojects {

    repositories {

    jcenter()

    }

    }

    Open the app-level build.gradle file for your app, and add compile dependencies in the dependencies section.

    buildscript {

    repositories {

    jcenter()

    }

    }

    dependencies {

    // Vungle SDK

    implementation 'com.vungle.early-access:publisher-sdk-android:6.5.0'

    implementation "androidx.core:core:1.1.0"

    implementation "androidx.localbroadcastmanager:localbroadcastmanager:1.0.0"

    // When appcompat is being used, core and localbroadcastmanager are the dependencies

    // that is getting included

    // implementation 'androidx.appcompat:appcompat:1.1.0'

    // Recommended for SDK to be able to get Android Advertising ID

    implementation 'com.google.android.gms:play-services-basement:17.1.1'

    implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0'

    }

    If you include the Vungle SDK via Maven, you can skip to " Step 2. Import the Vungle SDK."

    Option 2. JAR/AAR Integration

    Download Vungle SDK v. 6, unzip it, go to the libs folder, copy all the jars and add them to your project libs folder.

    vungle-android-sdk-6.5.0.jar

    converter-gson-2.5.0.jar

    gson-2.8.2.jar

    logging-interceptor-3.12.0.jar

    okhttp-3.12.0.jar

    okio-1.15.0.jar

    retrofit-2.5.0.jar

    androidx-vng-moat-mobile-app-kit-2.5.1.jar

    Note : This zip file contains SDK as a .jar as well as an .aar. Use only one of these depending on jar/aar integration. In case if you are using remote JCenter gradle integration, this zip file and its contents are not needed.

    Open the project-level build.gradle, and update the repositories section:

    allprojects { repositories { jcenter() }}

    Open the app-level build.gradle file for your app, and add other dependencies in the dependencies section. If you are using .aar instead of .jar, you do not need to includeVNG-moat-mobile-app-kit-2.5.1.jarsince .aar is already packaged with this library.

    dependencies {

    // Vungle SDK

    implementation files('libs/vungle-android-sdk-6.5.0.jar')

    // Required Third-party Dependencies

    implementation files('libs/converter-gson-2.5.0.jar')

    implementation files('libs/gson-2.8.2.jar')

    implementation files('libs/logging-interceptor-3.12.0.jar')

    implementation files('libs/okhttp-3.12.0.jar')

    implementation files('libs/okio-1.15.0.jar')

    implementation files('libs/retrofit-2.5.0.jar')

    implementation files('libs/androidx-vng-moat-mobile-app-kit-2.5.1.jar') // Exclude when using AAR

    implementation "androidx.core:core:1.1.0"

    implementation "androidx.localbroadcastmanager:localbroadcastmanager:1.0.0"

    // When appcompat is being used, core and localbroadcastmanager are the dependencies

    // that is getting included

    // implementation 'androidx.appcompat:appcompat:1.1.0'

    // Recommended for SDK to be able to get Android Advertising ID

    implementation 'com.google.android.gms:play-services-basement:17.0.0'

    implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0'

    }

    Update AndroidManifest.xml by adding the following lines to your AndroidManifest.xml and assigning the application item name to your application class name for multidex:

    <!--Required Permissions-->

    <uses-permission android:name="android.permission.INTERNET" />

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <!--Recommended Permissions-->

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18" />

    <!--Vungle Activities-->

    <activity

    android:name="com.vungle.warren.ui.VungleActivity"

    android:configChanges="keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"

    android:launchMode="singleTop"

    android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />

    <activity

    android:name="com.vungle.warren.ui.VungleFlexViewActivity"

    android:configChanges="keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"

    android:launchMode="singleTop"

    android:hardwareAccelerated="true"

    android:theme="@android:style/Theme.Translucent.NoTitleBar" />

    <receiver

    android:name="com.vungle.warren.NetworkProviderReceiver"

    android:enabled="false">

    <intent-filter>

    <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />

    <category android:name="android.intent.category.DEFAULT" />

    </intent-filter>

    </receiver>

    Step 2. Import the Vungle SDK

    import com.vungle.warren.Vungle;

    import com.vungle.warren.AdConfig; // Custom ad configurations

    import com.vungle.warren.InitCallback; // Initialization callback

    import com.vungle.warren.LoadAdCallback; // Load ad callback

    import com.vungle.warren.PlayAdCallback; // Play ad callback

    import com.vungle.warren.VungleNativeAd; // In-Feed and MREC ad

    import com.vungle.warren.Banners; // Banner ad

    import com.vungle.warren.VungleBanner; // Banner ad

    import com.vungle.warren.Vungle.Consent; // GDPR consent

    import com.vungle.warren.VungleSettings // Minimum disk space

    import com.vungle.warren.error.VungleException // onError message

    Step 3. Initialize the Vungle SDK

    Starting with v6.3.12, we have removed the requirement for passing all placement reference ID to be used in the session during the initialization.SDK initialization can now be done without passing Collection of placement reference ID and all active placements for the application ID will be usable to play and load ad. You can still use the legacy API, but it is planned to bedeprecated in the future.

    // New v6 API

    public static void init(@NonNull String appId,

    @NonNull Context context,

    @NonNull InitCallback callback)

    // New since v6.4.11 API with optional minimum disk space configuration

    public static void init(@NonNull final String appId,

    @NonNull final Context context,

    @NonNull final InitCallback callback,

    @NonNull final VungleSettings settings)

    // Legacy v6 API

    @Deprecated

    public static void init(@NonNull final Collection placements,

    @NonNull String appId,

    @NonNull Context context,

    @NonNull InitCallback callback)

    The initialization method takes the following parameters:

    Vungle Application ID

    Application context

    InitCallback

    onSuccess: notifies when SDK has successfully initialized

    onError: notifies when the initialization has failed

    Throws IllegalArgumentException if InitCallback is null.

    Starting with v6.5.0, throws VungleException if required arguments are missing or invalid. For v6.4.11 and below, Throwable object was passed.

    onAutoCacheAdAvailable: notifies when the auto-cached placement has an ad available to play

    VungleSettings (optional)

    Specify minimum space available on device for SDK initialization and operation

    For all placements, loadAd must be explicitly issued as described in Step 5. Load an Ad.

    Vungle.init(appId, getApplicationContext(), new InitCallback() {

    @Override

    public void onSuccess() {

    // Initialization has succeeded and SDK is ready to load an ad or play one if there

    // is one pre-cached already

    }

    @Override

    public void onError(VungleException exception) {

    // Initialization error occurred - exception.getLocalizedMessage() contains error message

    }

    @Override

    public void onAutoCacheAdAvailable(String placementId) {

    // Callback to notify when an ad becomes available for the cache optimized placement

    // NOTE: This callback works only for the cache optimized placement. Otherwise, please use

    // LoadAdCallback with loadAd API for loading placements.

    }

    };

    You can check whether Vungle SDK is initialized anytime by calling the isInitialized method:

    public static boolean isInitialized()

    Step 4. Event Listener

    Implement LoadAdCallback for ad load events and PlayAdCallback for ad play events now if you want to use generic callback for all events. Otherwise, skip to Step 5. Load an Ad to implement inline callbacks.

    Note: Starting with v6.5.0, onError callback for PlayAdCallback and LoadAdCallback passes VungleException compared to a Throwable object for v6.4.11 and below.

    // Implement LoadAdCallback

    private final LoadAdCallback vungleLoadAdCallback = new LoadAdCallback() {

    @Override

    public void onAdLoad(String placementReferenceId) {

    // Placement reference ID for the placement to load ad assets

    }

    @Override

    public void onError(String placementReferenceId, VungleException exception) {

    // Placement reference ID for the placement that failed to download ad assets

    // VungleException contains error code and message

    }

    };

    // Implement PlayAdCallback

    private final PlayAdCallback vunglePlayAdCallback = new PlayAdCallback() {

    @Override

    public void onAdStart(String placementReferenceId) {

    // Placement reference ID for the placement to be played

    }

    @Override

    public void onAdEnd(String placementReferenceId, boolean completed, boolean isCTAClicked) {

    // Placement reference ID for the placement that has completed ad experience

    // completed has value of true or false to notify whether video was

    // watched for 80% or more

    // isCTAClkcked has value of true or false to indicate whether download button

    // of an ad has been clicked by the user

    }

    @Override

    public void onError(String placementReferenceId, VungleException exception) {

    // Placement reference ID for the placement that failed to play an ad

    // VungleException contains error code and message

    }

    };

    Step 5. Load an Ad

    The LoadAdCallback will be notified about the load state for the call to which it was assigned. The SDK only references this callback and does not store it anywhere; it is the responsibility of the caller to ensure that the callback is managed properly.

    public static void loadAd(@NonNull final String id, @Nullable LoadAdCallback callback)

    // Load Ad Implementation

    if (Vungle.isInitialized()) {

    Vungle.loadAd("PLACEMENT_ID", new LoadAdCallback() {

    @Override

    public void onAdLoad(String placementReferenceId) { }

    @Override

    public void onError(String placementReferenceId, VungleException exception) { }

    });

    }

    Step 6. Check Ad Availability

    Use static method canPlayAdmethod to check if there is an ad available to play for the placement before invoking the playAdmethod

    public static boolean canPlayAd(@NonNull String id)

    Step 7. Play an Ad

    To play an ad, invoke theplayAdmethod, with the placement reference ID, optional AdConfig (null if not being used), and a PlayAdCallback event listener, which will be notified of success or errors during ad playback.

    public static void playAd(@NonNull final String id, final AdConfig settings, @Nullable final PlayAdCallback listener)

    You should always check ad availability by calling the canPlayAd method before invoking the playAd method. You must also make sure that an additional playAd is not issued before your receive an onAdEnd or an onError callback from the initial playAd call, because the ad will not render properly if playAd is repeatedly called in quick succession.

    if (Vungle.canPlayAd("PLACEMENT_ID")) {

    Vungle.playAd("PLACEMENT_ID", null, new PlayAdCallback() {

    @Override public void onAdStart(String placementReferenceId) { }

    @Override public void onAdEnd(String placementReferenceId, boolean completed, boolean isCTAClicked) { }

    @Override public void onError(String placementReferenceId, VungleException exception) { }

    });

    }

    Re-initialize SDK when onErroroccurs

    On rare occurrences, resources can become limited, causing the system to deallocate either part of the Vungle SDK, or some of the third-party dependencies our SDK requires. In such cases, LoadAdCallback and PlayAdCallback fire an onError callback with a VungleException object with a code VungleException.VUNGLE_NOT_INTIALIZED. This indicates that the Vungle SDK is in an inoperable state and must be re-initialized.

    if (e.getExceptionCode() == VungleException.VUNGLE_NOT_INTIALIZED) {

    // Re-initialize Vungle SDK

    }

    Native Ads

    In-Feed Ads

    The In-Feed ad format does not require a full screen to display; instead, the Publisher determines the exact dimensions and location of the ad container within their app. These ad containers can be in collection views or table/list views.

    Loading an In-Feed Ads

    The Publisher must load an ad for the In-Feed container. Loading a In-Feed ad is same as loading a full-screen or interstitial ad; however, the placement must be configured to support In-Feed.

    Displaying an In-Feed Ad

    Displaying In-Feed ads differs from displaying full-screen ads. With In-Feed ads, you must first create a container for the ad. This container is a Layout. You can place said RelativeLayout anywhere on the screen. The ad will scale to any size of container, but keep in mind that very low resolution will make ads less visible. You must then call the Vungle.getNativeAd to get the In-Feed ad object and call the addView function to associate the container with the In-Feed ad.

    private RelativeLayout flexfeedContainer = findViewById(...);

    VungleNativeAd vungleNativeAd = Vungle.getNativeAd("INFEED_ID", new AdConfig(), vunglePlayAdCallback);

    if (vungleNativeAd != null) {

    View nativeAdView = vungleNativeAd.renderNativeView();

    flexfeedContainer.addView(nativeAdView);

    }

    Note: There was a change in getNativeAd API starting from version 6.5.0. If you are using version 6.4.11 or below, there is no need to pass AdConfig object and you would need placement reference ID and VunglePlayAdCallback only.

    Vungle.getNativeAd("INFEED_ID", vunglePlayAdCallback);

    Closing an In-Feed Ad

    Because the In-Feed ad view has been added to your container view, it must also be removed in case the ad view disappears from the screen, the activity or fragment is destroyed, or the parent view container is recycled or destroyed. Without closing the ad, attempting to play another In-Feed ad will cause unexpected behavior in your app. Please invoke finishDisplayingAd to end ad experience and we recommend that you remove the view onAdEnd event.

    private VungleNativeAd vungleNativeAd;

    // Calling finishDisplayingAd when you want to finish displaying In-Feed Ad

    // will trigger onAdEnd and will tell you when you can remove the child

    // In-Feed view container

    vungleNativeAd.finishDisplayingAd();

    // And removing empty ad view from container

    @Override

    public void onAdEnd(String id, boolean completed) {

    parentView.removeView(nativeAdView);

    vungleNativeAd = null;

    }

    Attaching and Detaching the State of an In-Feed Ad

    If the user scrolls to a point where the video ad is no longer visible on the screen, the Publisher must pause the video, and resume it when it is again visible. To control the pause and resume states, call setAdVisibility from the VungleNativeAd instance, and set it to true when the video is visible and to false when the video goes off screen. The setAdVisibility is not to be confused with View visibility: this setter informs Vungle SDK whether the Native ad view is visible or not, and depending on it, the SDK pauses/resumes video playback.

    To Pause an In-Feed Ad

    vungleNativeAd.setAdVisibility(false);

    To Resume an In-Feed Ad

    vungleNativeAd.setAdVisibility(true);

    MREC Ads

    From SDK version 6.4.11 and above, Vungle supports MREC video ads, which does not require full screen view, similar to In-Feed ad. The container size to render MREC ad is 300 by 250 which is the industry standard. MREC video ads can be set anywhere on the screen and the user can continue using the app while the ad is being played.

    Loading an MREC Ad

    Loading an MREC ad is same as loading a full screen ad. However, the placement must be configured to support MREC feed. Please contact your Vungle account manager to enable MREC for a placement.

    Displaying an MREC Ad

    Since the view size is fixed, the container which is used to display MREC must be specified to be 300dp by 250dp, and the view can be placed anywhere on the screen. This container is a Layout. You can place said RelativeLayout anywhere on the screen. You must then call AdConfig.setAdSize to specify ad size to be AdConfig.AdSize.VUNGLE_MREC and pass this object when calling Vungle.getNativeAd to get the MREC ad object. finally call the addView function to associate the container with the MREC ad. Vungle MREC plays with sound enabled by default but you can use setMuted option set to true to start the video muted.

    private RelativeLayout mrecContainer = findViewById(...);

    AdConfig adConfig = new AdConfig();

    adConfig.setAdSize(AdConfig.AdSize.VUNGLE_MREC);

    adConfig.setMuted(true);

    VungleNativeAd vungleNativeAd = Vungle.getNativeAd("MREC_ID", adConfig, vunglePlayAdCallback);

    View nativeAdView = vungleNativeAd.renderNativeView();

    mrecContainer.addView(nativeAdView);

    Closing an MREC Ad

    Because the MREC ad view has been added to your container view, it must also be removed in case the ad view disappears from the screen, the activity or fragment is destroyed, or the parent view container is recycled or destroyed. Without closing the ad, attempting to play another MREC ad will cause unexpected behaviour in your app. Please invoke finishDisplayingAd to end ad experience and we recommend that you remove the view onAdEnd event.

    private VungleNativeAd vungleNativeAd;

    // Calling finishDisplayingAd when you want to finish displaying MREC Ad

    // will trigger onAdEnd and will tell you when you can remove the child

    // MREC view container

    vungleNativeAd.finishDisplayingAd();

    // And removing empty ad view from container

    @Override

    public void onAdEnd(String id, boolean completed) {

    parentView.removeView(nativeAdView);

    vungleNativeAd = null;

    }

    Attaching and detaching the state of an MREC Ad

    If the user scrolls to a point where the video ad is no longer visible on the screen, the Publisher must pause the video, and resume it when it is again visible. To control the pause and resume states, call setAdVisibility from the VungleNativeAd instance, and set it to true when the video is visible and to false when the video goes off screen. The setAdVisibility is not to be confused with View visibility: this setter informs Vungle SDK whether the native ad view is visible or not, and depending on it, the SDK pauses/resumes video playback.

    To Pause an MREC Ad

    vungleNativeAd.setAdVisibility(false);

    To Resume an MREC Ad

    vungleNativeAd.setAdVisibility(true);

    Banner Ads

    Vungle supports Banner video ads starting with SDK version 6.5.0. The container size to render banner ads can be 320x50, 300x50 or 728x90 (for tablets). Banner ads can be set anywhere on the screen and the user can continue using the app while the ad is being played.

    Banner Size

    Dimensions

    AdConfig.AdSize.BANNER

    320x50

    AdConfig.AdSize.BANNER_SHORT

    300x50

    AdConfig.AdSize.BANNER_LEADERBOARD

    728x90 (for tablets)

    Loading a Banner Ad

    Loading a banner ad works different than other ad formats. There is specific Banners API that you use to load, play and check for ad availability. You would need to specify size of the banner that you want to load and SDK will automatically refresh it with the time interval that you configured on the dashboard. The placement must be also configured to support banner feed so please contact your Vungle account manager to enable banner ad for a placement.

    Banners.loadBanner("BANNER_ID", AdConfig.AdSize.BANNER, vungleLoadAdCallback);

    You can check for banner ad availability by calling canPlayAd method.

    Banners.canPlayAd(ad.placementReferenceId, AdConfig.AdSize.BANNER);

    Displaying a Banner Ad

    Since the view size is fixed, the container which is used to display Banner ads must be specified to be one of the supported sizes 320x50, 300x50 or 728x90 (for tablets), and the view can be placed anywhere on the screen. This container is a LayOut it must have a size equal to or greater than the banner size being used. You can place said LayOut anywhere on the screen. Then you will pass the size of banner you are using Banners API.

    Pass this object when callingBanners.loadBannerto specify the size you displaying and use Banners.getBanner to get the Banners ad object. finally call the addView method to associate the container with the Banner ad.

    private RelativeLayout bannerContainer = findViewById(...);

    // Check for banner ad availability and display

    if (Banners.canPlayAd("BANNER_ID", AdConfig.AdSize.BANNER)) {

    VungleBanner vungleBanner = Banners.getBanner("BANNER_ID", AdConfig.AdSize.BANNER, vunglePlayAdCallback);

    bannerContainer.addView(vungleBanner);

    }

    Closing a Banner Ad

    Because the banner ad view has been added to your container view, it must also be removed in case the ad view disappears from the screen, the activity or fragment is destroyed, or the parent view container is recycled or destroyed. Without closing the ad, attempting to play another banner ad will cause unexpected behaviour in your app.

    vungleBanner.destroyAd();

    Advanced Banner Configuration

    For most cases, above integration will be sufficient and VungleBanner will be managed. However, if VungleBanner view is inside a list or RecyclerView, the managed VungleBanner will not work correctly. The moment the user scrolls the ad offscreen and scrolls back, the ad will be finished and no longer there. For such case, we have advanced API to fine control the VungleBanner. Please refer to our main banner integration guide for more information.

    Google Play Services (Optional)

    Including Google Play Services with your project allows Vungle to provide a more customized ad experience to the end user. Including basement and ads-identifier APIs are optional but recommended. We recommend using version 11.0.1 or higher.

    To include Google Play Services, we recommend Google's setup guide. In your app, ensure that the device has a sufficiently updated version of Google Play Services. Vungle SDK optionally utilizes the location and ads API from Google Play Services.

    google.android.gms:play-services-basement:16.0.0 // Recommended

    google.android.gms:play-services-ads-identifier:16.0.0 // Required for AAID

    Method Count Reduction

    Adding Vungle Android SDK v6 to your project will add approximately 700 core Vungle methods, excluding any transitive dependencies. A full integration including third-party libraries is expected to add less than 4000 methods in average. Consider the following suggestions to reduce the total number of methods added to your project.

    ProGuard: You can enable ProGuard to shrink your project code. It will discard any unused classes at the time of compilation to make the total method count as small as possible. You can enable it by specifying minifyEnabled true in build.gradle for appropriate build type and by providing the rules to keep the classes that is required by your project.

    Multidex: If you are still above a 65K method count, enabling multiDex may be the only solution provided by Google. You need to configure your project to multiDex only one time, but it will have an impact on build and app startup time.

    Proguard

    If you are using Proguard, add the following rules to your ProGuard configuration file:

    # Vungle

    -keep class com.vungle.warren.** { *; }

    -keep class com.vungle.warren.downloader.DownloadRequest

    -dontwarn com.vungle.warren.error.VungleError$ErrorCode

    -dontwarn com.vungle.warren.downloader.DownloadRequest$Status-keepclassmembers enum com.vungle.warren.** { *; }

    # Moat SDK

    -keep class com.moat.** { *; }

    -dontwarn com.moat.**

    -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement

    -keepattributes *Annotation*

    # Retrofit

    -keepattributes Signature, InnerClasses

    -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement

    -dontwarn javax.annotation.**

    -dontwarn kotlin.Unit

    -dontwarn retrofit2.-KotlinExtensions

    -keepclassmembers,allowshrinking,allowobfuscation interface * {

    @retrofit2.http.* <methods>;

    }

    # Okio+OkHttp

    -dontwarn okhttp3.**

    -dontwarn okio.**

    -dontwarn javax.annotation.**

    -dontwarn org.conscrypt.**

    -keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase

    -keepclassmembers class * extends com.vungle.warren.persistence.Memorable {

    public <init>(byte[]);

    }

    Minimum disk space

    Minimum disk space configuration was introduced in v6.4.11 to determine the limits for available space on a users device before the Vungle SDK initializes and fetch ads. Default value for setMinimumSpaceForInit is 51 MB and setMinimumSpaceForAd is 50 MB. The size is entered in bytes.

    VungleSettings vungleSettings = new VungleSettings.Builder()

    .setMinimumSpaceForInit(51L * 1024L * 1024L) // 51 MB

    .setMinimumSpaceForAd(50L * 1024L * 1024L) // 50 MB

    .build();

    Vungle.init(appId, getApplicationContext(), initCallback, vungleSettings);

    Restrict usage of device ID

    For Android SDK version 6.4.11 onwards, publishers can now restrict transmission of Android ID which is used when Google Advertising ID is not available.

    // Set true to opt out for Android ID collection by SDK or false (default) to opt in

    VungleSettings vungleSettings = new VungleSettings.Builder()

    .setAndroidIdOptOut(true)

    .build();

    Vungle.init(appId, getApplicationContext(), initCallback, vungleSettings);

    Ad Configuration Options

    Ad Configuration

    You have the option to customize individual ads you play by providing a new adConfig object to playAd. AdConfig is an object and can be null, in which case the ad will play with default configurations; or it can be a non-null with overrides to the AdConfig setter. The following is an example of how to use AdConfig

    Vungle.playAd(placementReferenceID, adConfig, vunglePlayAdCallback);

    The above uses adConfig object that has customization option configuration and you set theAdConfig object as shown here

    AdConfig adConfig = new AdConfig();

    adConfig.setAdOrientation(AdConfig.AUTO_ROTATE);

    adConfig.setMuted(true);

    Vungle.playAd(placementReferenceID, adConfig, vunglePlayAdCallback);

    The following table shows all the available AdConfig options.

    Option

    Description

    setBackButtonImmediatelyEnabled

    true if back button should be enabled before ad close button appears, false otherwise

    setAdOrientation

    AdConfig.AUTO_ROTATEif the video ad is supposed to auto-rotate, otherwiseAdConfig.LANDSCAPE orAdConfig.PORTRAIT to follow video ad orientation

    setMuted

    false if the video should start with its audio settings matching those of your enclosing application, true if it should start muted regardless

    setOrdinal

    Takes an Integer value of ordinal count to track the number of ads that has been played in same session

    Note: You may use the same AdConfig object for multiple ads Placement Reference IDs you play.

    Customizing Rewarded Ads

    The pop-up message dialog for rewarded ads is configurable with setIncentivizedFields method.

    public static void setIncentivizedFields(@Nullable String userID, @Nullable String title, @Nullable String body, @Nullable String keepWatching, @Nullable String close)

    List of Valid Placements

    A helper method that returns Collection of String containing all valid Placement Reference IDs for the current session.

    public static Collection getValidPlacements()

    GDPR Recommended Implementation Instructions

    As of May 25th, the General Data Protection Regulation (GDPR) will be enforced in the European Union. To comply with GDPR, developers have two options.

    Option 1 (recommended): Publisher controls the GDPR consent process at the user level, then communicates the users choice to Vungle. To do this, developers can collect the users consent using their own mechanism, and then use Vungle APIs to update or query the users consent status. Refer to the GDPR Recommended Implementation Instruction section for details.

    Option 2: Allow Vungle to handle the requirements. Vungle will display a consent dialog before playing an ad for a European user, and will remember the users consent or rejection for subsequent ads.

    The updateConsentStatus method (as recommended in Option 1) takes user consent status and consent message version as its parameters.

    public static void updateConsentStatus(@NonNull Consent status, @NonNull String consentMessageVersion)

    The consent status will specify whether the user has OPTED_IN or OPTED_OUT for the message being displayed by the publisher. The consentMessageVersion indicates publisher controlled consent policy version to allow publisher getting consent again when GDPR policy changes by pooling users by the message version.

    // Usage example of GDPR API

    // To set the user's consent status to opted in:

    Vungle.updateConsentStatus(Vungle.Consent.OPTED_IN, 1.0.0);

    // To set the user's consent status to opted out:

    Vungle.updateConsentStatus(Vungle.Consent.OPTED_OUT, 1.0.0);

    // To find out what the user's current consent status is:

    // This will return null if the GDPR Consent status has not been set

    // Otherwise, it will return Vungle.Consent.OPTED_IN or Vungle.Consent.OPTED_OUT

    Vungle.Consent currentStatus = Vungle.getConsentStatus();

    String consentMessageVersion = Vungle.getConsentMessageVersion();

    Hardware Acceleration

    Hardware acceleration Hardware acceleration is enabled by default for your application if your target API level is set to 14 or above. This option must be enabled for the SDK to properly show Dynamic Template, In-Feed and MREC ads. Make sure this option is set to 'true' at application level of your project.

    <application android:hardwareAccelerated="true" ...>

    Retrieving the SDK Version Number

    To programmatically retrieve the SDK version number at runtime (this useful in internal mediation), Vungle provides the following String:

    com.vungle.warren.BuildConfig.VERSION_NAME

    Debugging Exception Code

    InitCallback, PlayAdCallback and LoadAdCallback will have VungleException code when onError callback fires. You can use the code to debug or take actions to correct the issue programmatically.

    if (exception.getExceptionCode() == VungleException.VUNGLE_NOT_INTIALIZED) {

    // Call routine to initialize SDK

    }

    Exception Code

    Description

    CONFIGURATION_ERROR

    Configuration Error Occurred. Please check your app ID and placement reference IDs, and try again when network connectivity is available.

    NO_SERVE

    Ad server found no advertisements are available for your current bid. Please try again later. Occurrence of this exception is expected behavior.

    UNKNOWN_ERROR

    Unknown Error Occurred. Occurrence of this exception should be rare.

    AD_EXPIRED

    The advertisement in the cache has expired and can no longer be played. Please load another ad.

    MISSING_REQUIRED_ARGUMENTS_FOR_INIT

    Please ensure all parameter for init marked as NonNull are provided, as they are essential for functioning of our SDK.

    APPLICATION_CONTEXT_REQUIRED

    Please provide Application context so our SDK can continue to support our API beyond Activity lifecycle.

    OPERATION_ONGOING

    There is already an ongoing operation for the action you requested. Please wait until the operation finished before starting another.

    VUNGLE_NOT_INTIALIZED

    Vungle is not initialized or no longer initialized. Please call Vungle.init() to reinitialize.

    AD_UNABLE_TO_PLAY

    Unable to play advertisement.

    AD_FAILED_TO_DOWNLOAD

    Advertisement failed to download.

    PLACEMENT_NOT_FOUND

    Placement is not valid.

    SERVER_RETRY_ERROR

    Remote Server responded with http Retry-After, SDK will retry this request.

    Configuring Auto Backup for JAR Integration

    The Allow backup setting is enabled by default for your application for API 23 or above.The backup rule ensures that all application data is backed up for proper operation of Vungle SDK and application itself. If you have not disabled the allow backup setting or specified your own backup rules, you must provide additional .xml rules to define which files in our SDK file system should be excluded from automatic backup.

    Vungle Exclusion Rules

    <full-backup-content>

    <exclude domain="file" path="vungle" />

    <exclude domain="file" path="vungle_cache" />

    <exclude domain="external" path="vungle_cache" />

    <exclude domain="database" path="vungle_db" />

    <exclude domain="sharedpref" path="com.vungle.sdk.xml" />

    </full-backup-content>

    Gradle Integration with Developer Backup Rules

    Add Vungle SDK exclusion rules to the existing .xml file that has your apps own exclusion rules.

    Configure fullBackupContent to be replaced on the application level and add the Vungle SDK exclusion rule to the existing .xml.

    JAR Integration with developer backup rules

    Create a new XML file with Vungle exclusion rules.

    Place the .xml file under the res/xml directory.

    Add fullBackupContent in the application tag of AndroidManifest.xml with the file name of the .xml file you created above.

    <application

    android:fullBackupContent="@xml/vungle_backup_rule">

    Disabling Auto Backup

    If backup is not required for your app, you can simply disable it on the application tag:

    <application

    android:allowBackup="false" >

    View Article
  • Use this guide to add VungleAndroid SDK into yourapp, usingMoPub as yourmain advertising mediation layer. MoPub Android adapter 6.5.0 is compatible with Vungle Android SDK 6.5.0.

    Download Vungle Android SDK 6.5.0

    Download MoPub Android Adapter 6.5.0

    MoPub Android 6.5.0 Repository

    Contents

    Before You Begin

    Step 1. Set Up Vungle as a Network

    Set Up Vungle as an SDK Network

    Set Up Vungle as a Custom Native Network

    Step 2. Add Vungle as a Third-Party Ad Network

    Banner Ad Size

    Optional Advanced Settings

    Early SDK Initialization

    Memory Settings

    Restrict usage of device ID

    Interstitial Ads

    Rewarded Ads

    Additional Note

    Before You Begin

    The Vungle Android SDK 6.5.0 has been tested with MoPub Android SDK 5.9.0.

    The MoPub Dashboard does not yet include Vungle placements. You can check placement level performance using our Reporting API for Publishers.

    MoPub must be set up in your app before starting this tutorial. For a step-by-step guide, refer to MoPubs Getting Started Guide for Android.

    You will need the Vungles App ID and all the placement reference IDs you want to use in your app. You can find these IDs in the Vungle Dashboard (refer to Setting Up and Reporting on Placements ).

    Interstitial: https://developers.mopub.com/publishers/android/interstitial/

    Rewarded Video: https://developers.mopub.com/publishers/android/rewarded-video/

    Banner (320 x 50), Leaderboard (728 x 90), MREC (300 x 250): https://developers.mopub.com/publishers/android/banner/

    Vungle SDK requiresAndroid OS 4.0 (Ice Cream Sandwich - API version 14) and up

    Step 1. Set Up Vungle as an SDK Network or as a Custom Native Network

    Set Up Vungle as an SDK Network

    Log in to the MoPub dashboard and select Networks from the main navigation panel.

    Click New Network. Hardware acceleration and select Vungle.

    In the Network Settings section, if you Enable reporting access, enter your Reporting API Key from the Vungle Dashboard.

    In App & Ad Unit Setup, enter the Vungle Application ID and Placement Reference IDs.

    Set Up Vungle as a Custom Native Network

    To ensure that the MoPub servers recognize the integrated Vungle Adapters, set up Vungle as a Custom Native Network in the MoPub dashboard.

    Log into the MoPub dashboard, and select Networks from the main navigation bar.

    Click New network button on the top right. and select Vungle from the list.

    After creating Vungle as a Network, click on the name from the list of Networks. In the Set Up Your Inventory section, for each ad unit that will use the Vungle SDK to present video ads, ensure that the MoPub SDK can find the network adapter used to interact with the Vungle SDK:

    If you are using Rewarded Video for an ad unit, add com.mopub.mobileads.VungleRewardedVideo under the Custom Event Class section.

    If you are using Fullscreen (320 x 480) for an ad unit, add com.mopub.mobileads.VungleInterstitial under the Custom Event Class section.

    If you are using Banner (320 x 50), Leaderboard (728 x 90) orMedium (300 x 250) for an ad unit, add com.mopub.mobileads.VungleBanner under the Custom Event Class section.

    Add your Vungle App ID, placement reference ID of the placement to be called from the ad unit, and all placementreference IDsthat will be used in the app in JSON format under the Custom Event Class Data.

    Set the placement Reference ID you want to link to the MoPub Ad Unit for pid. Note: A default placement is created for each app automatically. You must provide its placement reference ID in this initialization step whether or not you plan to take advantage of the placements' functionality. If you create multiple placements, provide all the reference IDs.

    Make sure to link a placement that is set to rewarded type at Vungle dashboard to the MoPub Ad Unit that is set to Rewarded Video; and link a placement that is set to interstitial type at Vungle dashboard to the MoPub Ad Unit that is set to Fullscreen (320 x 480).

    {

    "appId":"5935efecc802d63d5100000f",

    "pid":"DEFAULT05223"

    }

    Note: The Vungle SDK will cache an ad automatically for the placement you selected to be Auto Cached in the Vungle Dashboard. We highly recommend selecting the MoPub Ad Unit shown first or the Ad Unit shown most frequently as the Auto Cached placement.

    Step 2. Add Vungle as a Third-Party Ad Network

    To add the Vungle Android SDK into your app using MoPub mediation:

    Add all the Vungle-related adapter files to the /src/main/java/com/mopub/mobileads/ directory in your apps project. This step is necessary because the MoPub SDK references these files as Custom Event Class properties in the directory.

    VungleAdapterConfiguration.java

    VungleBanner.java

    VungleInterstitial.java

    VungleNetworkSettings.java

    VungleRewardedVideo.java

    VungleRouter.java

    VungleRouterListener.java

    Follow the instructions in the Step 1. Include the Vungle SDK in Your Project section of Get Started with Vungle - Android SDK to add the necessary frameworks.

    If you need to set Multidex, Proguard and Google Play Services, follow the instructions in the Advanced Settings section of Get Started with Vungle - Android SDK toupdate AndroidManifest.xml in your project.

    Call the MoPubInterstitials show method (or, for rewarded ads, call the MoPubRewardedVideos's showRewardedVideo method) when you want to present a Vungle video ad. (No need to call the Vungle Android SDK methods directly. The MoPub SDK will do it.)

    Banner Ad Size

    Vungle supports following 3 banner ad sizes: Banner, Medium rectangle, Leaderboard. . Please use an ad container that is no smaller than the specified size and use corresponding MoPubView.MoPubAdSize height value when loading banner ads.

    Banner Formats

    Size

    MoPub Ad Size Configuration

    Banner

    320dp x 50dp

    MoPubView.MoPubAdSize.HEIGHT_50

    Leaderboard

    728dp x 90dp

    MoPubView.MoPubAdSize.HEIGHT_90

    Medium rectangle

    300dp x 250dp

    MoPubView.MoPubAdSize.HEIGHT_250

    Sample code:

    @Overridepublic MoPubView.MoPubAdSize getAdSize() { return MoPubView.MoPubAdSize.HEIGHT_250;}

    Optional Advanced Settings

    Early SDK Initialization (Recommended)

    MoPub Android SDK 5.5.0 and above allows you to early initialize ad network SDK when MoPub SDK completes initialization. We strongly recommend you to use this feature as it will allow additional time for Vungle SDK to pre-cache an ad and have it ready to play at display opportunity.

    Sample code:

    SharedPreferences mPreferences = PreferenceManager.getDefaultSharedPreferences(this);

    Map<String, String> vungleSettings = new HashMap<>();

    vungleSettings.put("appId", "YOUR_VUNGLE_APP_ID");

    SdkConfiguration configBuilder = new SdkConfiguration.Builder("MOPUB_AD_UNIT_WITH_VUNGLE_PLACEMENT")

    .withMediatedNetworkConfiguration(VungleAdapterConfiguration.class.getName(), vungleSettings)

    .build();

    MoPub.initializeSdk(this, configBuilder, initSdkListener());

    Memory Settings

    Starting from v6.4.0, you can prevent the SDK from downloading, requesting ads or even initializing if the storage of your Android device falls below a predefined threshold.

    These are the option keys available:

    Keys

    Type/Value

    Description

    pre_key_min_space_for_init

    String, value in bytes (default 51 MB)

    Sets the required minimum available free storage space to be able to initialize the SDK

    pre_key_min_space_for_ad

    String, value in bytes (default 50 MB)

    Sets the required minimum available free storage space to be able to request an ad

    Sample code:

    Map<String, String> vungleSettings = new HashMap<>();

    vungleSettings.put("appId", "YOUR_VUNGLE_APP_ID");

    vungleSettings.put("VNG_MIN_SPACE_INIT",

    mPreferences.getString("pref_key_min_space_for_init", String.valueOf(20 * 1024 * 1024)));

    vungleSettings.put("VNG_MIN_SPACE_LOAD_AD",

    mPreferences.getString("pref_key_min_space_for_ad", String.valueOf(20 * 1024 * 1024)));

    Restrict usage of device ID

    For SDK version 6.4.10 onwards, publishers can now restrict from passing Android ID from the device to the SDK.

    Map<String, String> vungleSettings = new HashMap<>();

    vungleSettings.put("appId", "YOUR_VUNGLE_APP_ID");

    vungleSettings.put("VNG_DEVICE_ID_OPT_OUT",

    String.valueOf(mPreferences.getBoolean("pref_key_key_android_id_opted_out", true)));

    Interstitial Ads

    Attribute

    Default Value

    Description

    SOUND_ENABLED_KEY

    true

    Play ad with sound muted or unmuted. Set to 'false' to play muted. Set to 'true' to play with sound.

    ORDINAL_VIEW_COUNT_KEY

    null

    If you receive ordinal data reports from Vungle, use this field to pass the mediation ordinal. This is an integer indicating the order in which this ad was shown in the game session (for example, if two ads were already shown in this session, and this ad from Vungle was then shown third, pass in '3'). Read more about ordinal data here.

    AD_ORIENTATION_KEY

    false

    Available Orientation:

    AdConfig.AUTO_ROTATE

    AdConfig.PORTRAIT

    AdConfig.LANDSCAPE

    AdConfig.MATCH_VIDEO

    Example

    HashMap<String, Object> extras = new HashMap<>();

    extras.put(VungleInterstitial.SOUND_ENABLED_KEY, false);

    extras.put(VungleInterstitial.ORDINAL_VIEW_COUNT_KEY, 1);

    extras.put(VungleInterstitial.AD_ORIENTATION_KEY, AdConfig.LANDSCAPE);

    mMoPubInterstitial.setLocalExtras(extras);

    mMoPubInterstitial.load();

    Rewarded Ads

    Attribute

    Default Value

    Description

    withUserId

    null

    Sets the unique user ID to pass to your application to verify that this user should be rewarded for watching an incentivized ad.

    withCancelDialogBody

    "Closing this video early will prevent you from earning your reward. Are you sure?"

    Sets the body of the confirmation dialog when skipping an incentivized ad.

    withCancelDialogCloseButton

    Close Video

    Sets the 'cancel button' text of the confirmation dialog when skipping an incentivized ad.

    withCancelDialogKeepWatchingButton

    Keep Watching

    Sets the 'keep watching button' text of the confirmation dialog when skipping an incentivized ad.

    withCancelDialogTitle

    Close Video?

    Sets the title of the confirmation dialog when skipping an incentivized ad.

    withSoundEnabled

    true

    Sets the starting sound state for the ad. If 'true', the audio respects device volume and sound settings. If 'false', video begins muted but user may modify.

    withOrdinalViewCount

    null

    If you receive ordinal data reports from Vungle, use this field to pass the mediation ordinal. This is an integer indicating the order in which this ad was shown in the game session (for example, if two ads were already shown in this session, and this ad from Vungle was then shown third, pass in '3'). Read more about ordinal data here.

    withAutoRotate

    AdConfig.AUTO_ROTATE

    Available Orientation:

    AdConfig.AUTO_ROTATE

    AdConfig.PORTRAIT

    AdConfig.LANDSCAPE

    AdConfig.MATCH_VIDEO

    Example

    VungleRewardedVideo.VungleMediationSettings vungleSettings = new VungleRewardedVideo.VungleMediationSettings.Builder()

    .withUserId("VUNGLE_USER_ID")

    .withCancelDialogBody("CUSTOM_BODY")

    .withCancelDialogCloseButton("CUSTOM_CLOSE")

    .withCancelDialogKeepWatchingButton("CUSTOM_KEEPWATCHING")

    .withCancelDialogTitle("CUSTOM_TITLE")

    .withSoundEnabled(true)

    .withOrdinalViewCount(10)

    .withAutoRotate(AdConfig.LANDSCAPE)

    .build();

    MoPubRewardedVideos.loadRewardedVideo(mAdUnitId, vungleSettings);

    Additional Note

    Android SDK - Hardware Acceleration

    is enabled by default if your target API level is set to 14 or above. This option must be enabled for the SDK to properly show Dynamic Template ads. Please make sure your project does not have this option set to false.

    < application android:hardwareAccelerated="true" ... >

    View Article
  • Contents

    Before You Begin

    Step 1. Set Up Your Unity Project with the Vungle Unity Plugin

    Step 2. Add Code

    Before You Begin

    iOS

    Unity 5.4.1 or higher, Unity 2017

    iOS 9 or higher

    The Vungle SDK requires that you link the WebKit.framework framework to your project. If you are developing for IOS 7, you mustset this framework to 'Optional'. To do this, click on your project in Project Navigator and go to General Linked Frameworks and Libraries. Select WebKit.framework and set the Status to Optional.

    Android

    Android 4.0 (Ice Cream Sandwich - API version 14 and above)

    Amazon OS 5.4 and above

    Unity 5.3.2 or higher, Unity 2017

    requires Java 1.7 for Android

    Windows

    Windows 10 UWP and Universal 8.1 supports Unity 5.3.2 or higher,Unity 2017

    Download Vungle Unity plugin from this link

    Download our sample app at https://github.com/Vungle/Unity-Plugin/tree/6.5.0

    Unity 2018 and 2019 are not officially supportd yet as of Unity Plugin v6.5

    Step 1. Set Up Your Unity Project with the Vungle Unity Plugin

    Add the Vungle Unity Plugin to your Unity Project

    With your project open in Unity, double-click the downloaded VunglePlugin.unitypackage file to add the Vungle Unity Plugin to your application. When the Import Unity Package window opens, click All to select everything before importing.

    Target the Correct Platform in Your Build Settings

    To avoid compilation errors during the next step, make sure that your project Build Settings (cmd + Shift + B) are targeting the iOS or Android platform.

    Amazon Appstore

    Vungle Android SDK supports Amazon OS 5.4 and higher. You can submit Android APK to the Amazon Appstore, with the additional setup of Unity Amazon Appstore configuration. Refer to the Unity instructions at the following link: https://docs.unity3d.com/Manual/UnityIAPAmazonConfiguration.html.

    Google Play Services

    Including Google Play Services with your project allows Vungle to provide a more customized ad experience to the end user, but it's not required. We recommend using version 16.0.0 or higher.

    To include Google Play Services, we recommend Google's setup guide found on the developer portal at http://developer.android.com/google/play-services/setup.html#Setup. In your app, ensure that the device has a sufficiently updated version of Google Play Services.

    Android Dependencies

    Vungle SDK for Android requires one of the following dependency to be included in your build. Please add them manually, or if you use a Gradle template you can include them in it.

    implementation 'androidx.appcompat:appcompat:1.1.0'

    // When appcompat is not used, core and localbroadcastmanager can be used instead

    // implementation "androidx.core:core:1.1.0"

    // implementation "androidx.localbroadcastmanager:localbroadcastmanager:1.0.0"

    Adding Hardware Acceleration (Android only)

    Hardware acceleration is enabled by default if your target API level is set to 14 or above. This option must be enabled for the SDK to properly show Dynamic Template and Native Flex ads. Please make sure your project does not have this option set to false.

    Sample code:

    <application android:hardwareAccelerated="true" ...>

    Step 2: Add Code

    In this walkthrough we initialize all of our Vungle-related code in a script attached to the main Game Object. You can call the Vungle Unity Plugin from any scripts you think are appropriate.

    Initialize the SDK

    Note: A default placement is created for each app automatically. You must provide its placement reference ID in this initialization step whether or not you plan to take advantage of the placements functionality. If you create multiple placements, provide all the reference IDs.

    Initialize the SDK as soon as your app starts in order to give the SDK enough time to cache an ad. To initialize the SDK, you will need the App IDs for the platforms you wish to support.

    You can find these IDs in the Vungle Dashboard (refer to " Setting Up and Reporting on Placements ").

    Sample code:

    public class VungleScript : MonoBehaviour {

    string appID = ""; string iosAppID = "ios_app_id"; string androidAppID = "android_app_id"; string windowsAppID = "windows_app_id";

    #if UNITY_IPHONE

    appID = iosAppID;

    #elif UNITY_ANDROID

    appID = androidAppID;

    #elif UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO

    appID = windowsAppID;

    #endif

    Vungle.init(appID);}

    Once the SDK is initialized successfully, it calls the following event:

    public static event Action onInitializeEvent;

    Refer to the Event Handling section of this article.

    Please reach out to your account manager about cache optimized placements to maximize caching performance.

    Once an ad is cached successfully, the adPlayableEvent event is called with the placement reference ID matching your placement. (Refer to the Check Ad Availability for a Placement section of this article.)

    Load an Ad for a Placement

    For all placements call theloadAd method to load an ad.

    public static void loadAd(string placementID)

    Make sure that you are using the placementID that is linked to the correct platform.

    Sample code:

    string placementID;

    #if UNITY_IPHONE

    placementID = "ios_placement_id";

    #elif UNITY_ANDROID

    placementID = "android_placement_id";

    #elif UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO

    placementID = "windows_placement_id";

    #endif

    Vungle.loadAd(placementID);

    Check Ad Availability for a Placement

    Once the SDK finishes caching an ad for a placement, the following event is called:

    public static event Action<string, bool> adPlayableEvent;

    Sample code:

    Vungle.adPlayableEvent += (placementID, adPlayable) => {

    if(placementID == "ios_placement_id") {

    playButtonPlacement1.enabled = adPlayable;

    }

    };

    Note:For the cache optimized placements, this event is called only when an ad becomes available. Optimized placements will automatically attempt to fill without further action. For all other placements, this event is also called in case of Load Failed (adPlayable returns false in this case).

    You can also check the ad availability for a placement with the following method:

    public static bool isAdvertAvailable(string placementID);

    Play an Ad

    Important: Do not play an ad untilthe adPlayableEvent function described above returns 'true'. If you try to play an ad before theadPlayableEvent function returns 'true', the user experience will be adversely affected while the ad tries to load. If deploying to Android, instead use the value returned from isAdvertAvailable() to ensure an ad is available (as adPlayableEvent will not return false when no ad is available).

    When there is an ad available for a placement, you can play the ad with the following method:

    public static void playAd(string placementID);

    Sample code:

    Vungle.playAd (placementID);

    Event Handling

    You can set up event handlers for all 5 Vungle SDK events surrounding ad presentation.

    The following event is fired when the SDK starts to play a video ad. This is a great place to pause gameplay, sound effects, animations, etc.

    public static event Action onAdStartedEvent;

    The following event is fired when the SDK closes an ad. This is a great place to reward your users and resume gameplay, sound effects, animations, etc.

    public static event Action<string, AdFinishedEventArgs> onAdFinishedEvent;

    The AdFinishedEventArgs class consists of the following properties for you to check the result of an ad play:

    public class AdFinishedEventArgs : EventArgs

    {

    //Represents a BOOL whether or not the user clicked the download button.

    public bool WasCallToActionClicked{ get; set;}

    //Represents a bool whether or not the video can be considered a completed view.

    public bool IsCompletedView{ get; set;}

    }

    The following event is fired when the SDK has changed ad availability status. The isAdPlayable boolean denotes the new playability of a specific placementID.

    public static event Action<string, bool> adPlayableEvent;

    Refer to the Check Ad Availability for a Placement section of this article for more details.

    The following event is fired when the SDK is initialized successfully.

    public static event Action onInitializeEvent;

    Sample code:

    void initializeEventHandlers() {

    Vungle.onAdStartedEvent += (placementID) => {

    DebugLog ("Ad " + placementID + " is starting! Pause your game animation or sound here.");

    };

    Vungle.onAdFinishedEvent += (placementID, args) => {

    DebugLog ("Ad finished - placementID " + placementID + ", was call to action clicked:" + args.WasCallToActionClicked + ", is completed view:"

    + args.IsCompletedView);

    };

    Vungle.adPlayableEvent += (placementID, adPlayable) => {

    DebugLog ("Ad's playable state has been changed! placementID " + placementID + ". Now: " + adPlayable);

    };

    Vungle.onInitializeEvent += () => {

    adInited = true;

    DebugLog ("SDK initialized");

    };

    }

    OnPause and OnResume Functionality

    Add code for the onPause and onResume functionality that enables ads that were paused when an app was backgrounded to resume playing.

    void OnApplicationPause(bool pauseStatus) {

    if (pauseStatus) {

    Vungle.onPause();

    }

    else {

    Vungle.onResume();

    }

    }

    Customization Options

    The playAd method can also accept an options dictionary to customize the ad playing experience.

    public static void playAd(Dictionary<string,object> options, string placementID);

    Note:Rewardedads are in some cases referred to asincentivizedads; both terms always refer to the same kind of ad. In the SDK code and in our Reporting API, we use the term 'incentivized'.

    The options dictionary accepts the following keys:

    Key

    Description

    orientation

    Sets the orientation of the ad.

    For iOS, use VungleAdOrientation:

    public enum VungleAdOrientation

    {

    Portrait = 1,

    LandscapeLeft = 2,

    LandscapeRight = 3,

    PortraitUpsideDown = 4,

    Landscape = 5,

    All = 6,

    AllButUpsideDown = 7

    }

    For Android, set to true for matchVideo and false for autoRotate.

    userTag

    String of the user key that is passed to identify users in the S2S call (if there are any).

    alertTitle

    String that is used as the title of the alert dialog presented when a user closes an incentivized ad experience prematurely.

    alertText

    String that is used as the body text of the alert dialog presented when a user closes an incentivized ad experience prematurely.

    closeText

    String title for the close button text of the alert dialog presented when a user closes an incentivized ad experience prematurely.

    continueText

    String title for the close button text of the alert dialog presented when a user closes an incentivized ad experience prematurely.

    immersive

    Boolean which sets Immersive Mode (forces hiding the navigation bar and status bar). (Android only)

    flexCloseSec

    Integer determining the number of seconds after which the Flex View ad can auto-dismiss. This setting only affects Flex View ads. (iOS only)

    Minimum disk space

    Minimum disk space configuration was introduced in version 6.4.0 to determine the limits for available space on a users device before the Vungle SDK initializes and fetch ads. Default value for SetMinimumDiskSpaceForInitialization is 51 MB and SetMinimumDiskSpaceForAd is 50 MB. The size is entered in bytes (not MB).

    Vungle.SetMinimumDiskSpaceForInitialization(minValue); Vungle.SetMinimumDiskSpaceForAd(minValue);

    Vungle.init(appID);

    Disable Hardware ID

    For SDK version 6.4.0 onwards, publishers can now restrict from passing Hardware ID from the device to the SDK.

    //Set false to opt in for Hardware ID collection by SDK or true to opt outVungle.EnableHardwareIdPrivacy(m_disableHardwareID);

    GDPR: Recommended Implementation

    As of May 25th, the General Data Protection Regulation (GDPR) will be enforced in the European Union. To comply with GDPR, developers have two options.

    Option 1 (recommended): Publisher controls the GDPR consent process at the user level, then communicates the users choice to Vungle. To do this, developers can collect the users consent using their own mechanism, and then use Vungle APIs to update or query the users consent status. Refer to the " GDPR Recommended Implementation Instructions " section for details.

    Option 2: Allow Vungle to handle the requirements. Vungle will display a consent dialog before playing an ad for a European user, and will remember the users consent or rejection for subsequent ads.

    GDPR Recommended Implementation Instructions

    To use Vungle APIs to update or query the users consent status as recommended in Option 1, use the Vungle.Consent enumerator and set the current value with the below two functions.

    // The Consent enum is used to represent the user's current GDPR opt-in status

    public enum Consent {

    Undefined = 0,

    Accepted = 1,

    Denied = 2

    }

    // Sets the user's consent status

    void updateConsentStatus(Vungle.Consent consent);

    // Sets the user's consent status and also sets a string to track GDPR version

    void updateConsentStatus(Vungle.Consent consent, string consentMessageVersion);

    // Gets the user's consent status Vungle.Consent getConsentStatus();

    Flex View Ads

    For iOS

    To programmatically close a Flex View ad, use the closeAd function:

    Vungle.closeAd(placementID);

    This function does not work on Android.

    For Android

    Flex View does not work the same on Unity Android as it does on Unity iOS or native Android. Because of a limitation in how Unity handles activities, Flex View does not allow a user to interact with the base game while a Flex View ad displays. In a Flex View ad, the underlying activity is suspended while an activity occurs on top. If a user leaves an app while a Flex View ad is visible and then returns to the app at a later date, the ad will still be displayed, but the background game will show up as black. This happens because the base activity is suspended until the Flex View ad is dismissed.

    For this reason, avoid Flex View ads on Unity Android.

    For Windows

    Flex View ads are unsupported on Windows.

    In-Feed Ads

    In-Feed ads are unsupported when integrating Vungle through the Unity plugin.

    View Article
  • Use this guide to add VungleiOS SDK into yourapp, usingMoPub as yourmain advertising mediation layer. MoPub iOS adapter 6.5.0.0 is compatible with Vungle iOS SDK 5.9.0.

    Download Vungle iOS SDK 6.5.0

    Download MoPub iOS Adapter 6.5.0

    Contents

    Before You Begin

    Step 1. Set Up Vungle as a Network

    Set Up Vungle as an SDK Network

    Set Up Vungle as a Custom Native Network

    Step 2. Add Vungle as a Third-Party Ad Network

    Banner Ad Size

    Optional Advanced Settings

    Early SDK Initialization

    Memory Settings

    Restrict IDFV Collection

    Rewarded Ads Customization

    Interstitial Ads Customization

    Before You Begin

    The Vungle iOS adapter 6.5.0 has been tested with MoPub iOS SDK 5.9.0.

    The MoPub Dashboard does not yet include Vungle placements; check your placement-level performance using our Reporting API for Publishers.

    MoPub must be set up in your app before starting this tutorial. For a step-by-step guide, refer to MoPubs Getting Started Guide for iOS.

    Refer to our MoPub integration documentation on integrating MoPub with your app.

    Interstitial: https://developers.mopub.com/docs/ios/interstitial/

    Rewarded Video: https://developers.mopub.com/docs/ios/rewarded-video/

    Banner (320 x 50), Leaderboard (728 x 90), MREC (300 x 250): https://developers.mopub.com/publishers/ios/banner/

    Set up the application with the right XCode and iOS SDK version as detailed in the Vungle iOS integration document.

    Step 1. Set Up Vungle as an SDK Network or as a Custom Native Network

    Set Up Vungle as an SDK Network

    Log in to the MoPub dashboard and select Networks from the main navigation panel.

    Click New Network. here and select Vungle.

    In the Network Settings section, if you Enable reporting access, enter your Reporting API Key from the Vungle Dashboard.

    In App & Ad Unit Setup, enter the Vungle Application ID and Placement Reference IDs.

    Set Up Vungle as a Custom Native Network

    To ensure that the MoPub servers recognize the integrated Vungle Adapters, set up Vungle as a Custom Native Network in the MoPub dashboard.

    Log into the MoPub dashboard, and navigate to Networks by the main navigation bar.

    Click New Network button on the top right. and select Vungle from the list.

    After creating Vungle as a Network, click on the name from the list of Networks. In the Set Up Your Inventory section, for each ad unit that will use the Vungle SDK to present video ads, ensure that the MoPub SDK can find the network adapter used to interact with the Vungle SDK:

    If you are using MoPub Rewarded Video for an Ad Unit, add VungleRewardedVideoCustomEvent under the Custom Event Class section.

    If you are using Interstitial for an Ad Unit, add VungleInterstitialCustomEvent under the Custom Event Class.

    If you are using MREC for an Ad Unit, add VungleBannerCustomEvent under the Custom Event Class.

    If you are using Banner (320 x 50), Leaderboard (728 x 90) orMedium (300 x 250) for an ad unit, add VungleBannerCustomeEventunder the Custom Event Class section.

    Add your Vungle App ID, placement reference ID of the placement to be called from the ad unit, and all placement reference IDsin JSON format under the Custom Event Class Data.

    Set the placement reference ID you want to link to the MoPub Ad Unit for pid.

    Make sure to link a placement that is set to rewarded type at Vungle dashboard to the MoPub Ad Unit that is set to Rewarded Video; and link a placement that is set to interstitial type at Vungle dashboard to the MoPub Ad Unit that is set to Fullscreen (320 x 480).

    {

    "appId":"59208865950e6d380100001f",

    "pid":"DEFAULT07430"

    }

    Note:The Vungle SDK will cache an ad automatically for the placement selected to be Cache Optimized in the Vungle Dashboard. Please reach out to your Account Manager for more information.

    Step 2. Add Vungle as a Third-Party Ad Network

    To add the Vungle iOS SDK into your app using MoPub mediation:

    Add all the Vungle-related adapter files to /AdNetworkSupport/Vungle/and make sure to include .m files in the project'sBuild Phases Compile Sources.

    VungleAdapterConfiguration.h

    VungleAdapterConfiguration.m

    VungleBannerCustomEvent.h

    VungleBannerCustomEvent.m

    VungleInstanceMediationSettings.h

    VungleInstanceMediationSettings.m

    VungleInterstitialCustomEvent.h

    VungleInterstitialCustomEvent.m

    VungleRewardedVideoCustomEvent.h

    VungleRewardedVideoCustomEvent.m

    VungleRouter.h

    VungleRouter.m

    Copy the VungleSDK.framework folder into /AdNetworkSupport/Vungle/SDK/.

    Make sure the project's Build Settings Framework Search Path includes the framework. For example:

    $(PROJECT_DIR)/AdNetworkSupport/Vungle/SDK/VungleSDK.framework

    Make sure the framework is included in the project's Build Phases Link Binary With Libraries.

    Follow the instructions in the Add Other Required Frameworks section of Get Started with Vungle - iOS SDK to add the necessary frameworks.

    Follow the instructions in the Add the -ObjC Linker Flag sectionof Get Started with Vungle - iOS SDK toadd the linker flag.

    Follow the instructions in the Remove the iOS Status Bar sectionof Get Started with Vungle - iOS SDK toremove the status bar.

    Call the MPInterstitialAdControllers showFromViewController method (or, for rewarded ads, call the MPRewardedVideo's presentRewardedVideoAdForAdUnitID method) when you want to present a Vungle video ad! (No need to call the Vungle iOS SDK methods directly. The MoPub SDK will do it.)

    Banner Ad Size

    Vungle supports following 3 banner ad sizes: Banner, Medium rectangle, Leaderboard. Please use an ad container that is no smaller than the specified size and use corresponding size configuration when requesting for banner ads.

    Banner Formats

    Size

    MoPub Ad Size Configuration

    Banner

    320dp x 50dp

    size:MOPUB_BANNER_SIZE

    Leaderboard

    728dp x 90dp

    size:MOPUB_LEADERBOARD_SIZE

    Medium rectangle

    300dp x 250dp

    size:MOPUB_MEDIUM_RECT_SIZE

    Sample code:

    self.adView = [[MPSampleAppInstanceProvider sharedProvider] buildMPAdViewWithAdUnitID:self.info.ID size:MOPUB_MEDIUM_RECT_SIZE];

    Optional Advanced Settings

    Early SDK Initialization (Recommended)

    MoPub iOS SDK 5.5.0 and above allows you to early initialize ad network SDK when MoPub SDK completes initialization. We strongly recommend you to use this feature as it will allow additional time for Vungle SDK to pre-cache an ad and have it ready to play at display opportunity.

    Sample code:

    MPMoPubConfiguration * sdkConfig = [[MPMoPubConfiguration alloc]

    initWithAdUnitIdForAppInitialization:@"MOPUB_AD_UNIT_WITH_VUNGLE_PLACEMENT"];

    NSMutableDictionary *configDictionary = [NSMutableDictionary dictionaryWithDictionary:@{ @"appId" : @"YOUR_VUNGLE_APP_ID" }];

    [sdkConfig setNetworkConfiguration:configDictionary forMediationAdapter:@"VungleAdapterConfiguration"];

    [[MoPub sharedInstance] initializeSdkWithConfiguration:sdkConfig

    completion:^{ NSLog(@"SDK initialization complete");

    }];

    Memory Settings

    Starting from v6.4.0, you can prevent the SDK from downloading, requesting ads or even initializing if the storage of your iOS device falls below a predefined threshold.

    These are the option keys available:

    Keys

    Type/Value

    Description

    vngMinSpaceForInit

    Integer, value in MB, default value is 50

    Sets the required minimum available free storage space to be able to initialize the SDK

    vngMinSpaceForAdLoad

    Integer, value in MB, default value is 50

    Sets the required minimum available free storage space to be able to request an ad

    Sample code:

    NSMutableDictionary *configDictionary = [NSMutableDictionary dictionaryWithDictionary:@{ @"appId" : @"YOUR_VUNGLE_APP_ID" }];

    [[NSUserDefaults standardUserDefaults] setValue:@(50) forKey:@"vngMinSpaceForInit"];

    [[NSUserDefaults standardUserDefaults] setValue:@(50) forKey:@"vngMinSpaceForAdLoad"];

    [sdkConfig setNetworkConfiguration:configDictionary forMediationAdapter:@"VungleAdapterConfiguration"];

    Restrict collection of IDFV

    Starting with iOS SDK 6.4.3, publishers can now restrict from passing IDFV when Limit Ad Tracking option is enabled on user's devices. Please import VungleRouter.h to access this API and use it in your AppDelegate before Vungle SDK gets initialized.

    Sample code:

    #import "VungleRouter.h"

    // Invoke setShouldCollectDeviceId before initialization of Vungle SDK

    [VungleRouter.sharedRouter setShouldCollectDeviceId:NO];

    Rewarded Ads Customization

    You can use VungleInstanceMediationSettings to customize rewarded ad experience.

    These are the option keys available:

    Keys

    Type/Value

    Description

    orientations

    0

    Auto-rotate

    1

    Landscape

    2

    Portrait

    Sets the orientation of the ad. We recommend allowing ads to auto-rotate, even if your app is in portrait. This way, the user has the option to watch full-size videos, resulting in a better user experience. You can achieve this by setting the orientation on a view controller level (rather than a project level).

    ordinal

    Integer

    If you receive ordinal data reports from Vungle, use this field to pass the mediation ordinal. This is an integer indicating the order in which this ad was shown in the game session (for example, if two ads were already shown in this session, and this ad from Vungle was then shown third, pass in 3). Read more about ordinal data here.

    startMuted

    YES or NO

    The Vungle SDK instance offers the option to play ads with the sound disabled.Please contact your account manager to enable it from Vungle dashboard as well.

    userIdentifier

    String

    Sets your user ID. The value is passed to Vungle server, and then sent to your server through server-to-server callback system if a placement is set to "Rewarded."

    Interstitial Ads Customization

    Starting with MoPub adapter 6.4.5.1, you can uselocalExtras to pass customization options for interstitial ads.

    These are the option keys available:

    Keys

    Type/Value

    Description

    orientations

    NSNumber

    0

    Auto-rotate

    1

    Landscape

    2

    Portrait

    Sets the orientation of the ad. We recommend allowing ads to auto-rotate, even if your app is in portrait. This way, the user has the option to watch full-size videos, resulting in a better user experience. You can achieve this by setting the orientation on a view controller level (rather than a project level).

    ordinal

    NSString

    If you receive ordinal data reports from Vungle, use this field to pass the mediation ordinal. This is an integer indicating the order in which this ad was shown in the game session (for example, if two ads were already shown in this session, and this ad from Vungle was then shown third, pass in 3). Read more about ordinal data .

    muted

    NSNumber

    YES or NO

    The Vungle SDK instance offers the option to play ads with the sound disabled.Please contact your account manager to enable it from Vungle dashboard as well.

    Sample code:

    NSNumber *orientations = [NSNumber numberWithInt:1];

    NSString *ordinal = @"10";

    NSNumber *muted = [NSNumber numberWithBool:YES];

    NSDictionary *localExtras = @{@"ordinal" : ordinal ?: @"",

    @"muted" : muted ?: @"",

    @"orientations" : orientations ?: @""};

    self.interstitial.localExtras = localExtras;

    View Article
  • This document has been prepared for publishers updating their existing v6 Vungle SDK integration as Android SDK 6.5.0 has API changes. Publisher updating from Vungle SDK 6.3.24 or 6.4.11 must make following API changes, but only the first item should affect most integration, second item affecting some publishers and last item should affect very few integration.

    1. onError callback from InitCallback, LoadAdCallback and PlayAdCallback now passes VungleException that contains error message and code instead of Throwable.

    New onError callback API for v6.5.0

    InitCallback LoadAdCallback PlayAdCallback

    Vungle.init("VUNGLE_APP_ID", getApplicationContext(), new InitCallback() {

    ...

    @Override

    public void onError(VungleException exception) { }

    ...

    });

    Vungle.loadAd("PLACEMENT_ID", new LoadAdCallback() {

    ...

    @Override

    public void onError(final String placementReferenceId, VungleException exception) { }

    ...

    });

    Vungle.playAd("PLACEMENT_ID", adConfig, new PlayAdCallback() {

    ...

    @Override

    public void onError(final String placementReferenceId, VungleException exception) { }

    ...

    });

    Deprecated onError callback for legacy v6

    InitCallback LoadAdCallback PlayAdCallback

    Vungle.init("VUNGLE_APP_ID", getApplicationContext(), new InitCallback() {

    ...

    @Override

    public void onError(Throwable throwable) { }

    ...

    });

    Vungle.loadAd("PLACEMENT_ID", new LoadAdCallback() {

    ...

    @Override

    public void onError(final String placementReferenceId, Throwable throwable) { }

    ...

    });

    Vungle.playAd("PLACEMENT_ID", adConfig, new PlayAdCallback() {

    ...

    @Override

    public void onError(final String placementReferenceId, Throwable throwable) { }

    ...

    });

    2. This is only applicable if you were previously using setAutoRotate feature by passing an AdConfig object during playAd. Previous SDK had setAutoRotate method that controls whether video ad can be rotated depending the ad orientation or this feature disabled. v6.5.0 has changed this feature to setAdOrientation method that configure ad to play in portrait and landscape only or set to auto-rotate.

    New setAdOrientation for v6.5.0

    AdConfig adConfig = new AdConfig();

    adConfig.setAdOrientation(AdConfig.AUTO_ROTATE) // AdConfig.PORTRAIT, AdConfig.LANDSCAPE

    Vungle.playAd("PLACEMENT_ID", adConfig, vunglePlayAdCallback);

    Deprecated setAutoRotate for legacy v6

    AdConfig adConfig = new AdConfig();

    adConfig.setAutoRotate(false); // true by default

    Vungle.playAd("PLACEMENT_ID", adConfig, vunglePlayAdCallback);

    3. This is only applicable for In-feed type ad which is not commonly used. The getNativeAd API for In-feed type ad now takes an additional AdConfig object.

    New In-feed type getNativeAd API for v6.5.0

    Vungle.getNativeAd("INFEED_ID", new AdConfig(), vunglePlayAdCallback);

    Deprecated In-feed type getNativeAd API for legacy v6

    Vungle.getNativeAd("INFEED_ID", vunglePlayAdCallback);

    View Article
  • Banner Ads

    Vungle supports Banner video ads starting with Android SDK version 6.5.0. The container size to render banner ads can be 320x50, 300x50 or 728x90 (for tablets). Banner ads can be set anywhere on the screen and the user can continue using the app while the ad is being played.

    This guide shows banner specific API and instruction on how to use them. Please refer to our main Android SDK integration documentation for the SDK requirements and additional information.

    Banner Size

    Dimensions

    AdConfig.AdSize.BANNER

    320x50

    AdConfig.AdSize.BANNER_SHORT

    300x50

    AdConfig.AdSize.BANNER_LEADERBOARD

    728x90 (for tablets)

    Initialize Vungle SDK

    Vungle.init("VUNGLE_APP_ID", getApplicationContext(), new InitCallback() {

    @Override

    public void onSuccess() { }

    @Override

    public void onError(VungleException exception) { }

    });

    Loading a Banner Ad

    Loading a banner ad works different than other ad formats. There is specific Banners API that you use to load, play and check for ad availability. You would need to specify size of the banner that you want to load and SDK will automatically refresh it with the time interval that you configured on the dashboard. The placement must be also configured to support banner feed so please contact your Vungle account manager to enable banner ad for a placement.

    Banners.loadBanner("BANNER_ID", AdConfig.AdSize.BANNER, new LoadAdCallback() {

    @Override

    public void onAdLoad(String id) { }

    @Override

    public void onError(String id, VungleException exception) { }

    });

    Displaying a Banner Ad

    Since the view size is fixed, the container which is used to display Banner ads must be specified to be one of the supported sizes 320x50, 300x50 or 728x90 (for tablets), and the view can be placed anywhere on the screen. This container is a LayOut it must have a size equal to or greater than the banner size being used. You can place said LayOut anywhere on the screen. Then you will pass the size of banner you are using Banners API.

    Pass this object when callingBanners.loadBannerto specify the size you displaying and use Banners.getBanner to get the Banners ad object. finally call the addView method to associate the container with the Banner ad.

    private RelativeLayout bannerContainer = findViewById(...);

    // Check for banner ad availability and get VungleBanner

    if (Banners.canPlayAd("BANNER_ID", AdConfig.AdSize.BANNER)) {

    VungleBanner vungleBanner = Banners.getBanner("BANNER_ID", AdConfig.AdSize.BANNER, new PlayAdCallback() {

    @Override

    public void onAdStart(String id) { }

    @Override

    public void onAdEnd(String id, boolean completed, boolean isCTAClicked) { }

    @Override

    public void onError(String id, VungleException exception) { }

    }); // Add VungleBanner to a view container

    bannerContainer.addView(vungleBanner);

    }

    Closing a Banner Ad

    Because the banner ad view has been added to your container view, it must also be removed in case the ad view disappears from the screen, the activity or fragment is destroyed, or the parent view container is recycled or destroyed. Without closing the ad, attempting to play another banner ad will cause unexpected behaviour in your app.

    vungleBanner.destroyAd();

    Advanced Banner Configuration

    For most cases, above integration will be sufficient and VungleBanner will be managed. However, if VungleBanner view is inside a ListView or RecyclerView, the managed VungleBanner will not work correctly. The moment the user scrolls the ad offscreen and scrolls back, the ad will be finished and no longer there. For such case, we have advanced API to fine control the VungleBanner.

    VungleBanner Class API

    These APIs give developers fine control over how to treat the VungleBanner across various lifecycle events in the developer application. In a majority of use cases, developers will not need to invoke these methods. Simply adding a VungleBanner into a parent view is enough. For special cases where a view will be recycled (i.e. RecyclerView, ListView, etc) or where we need to handle visibility manually (in certain older android devices, webview will not automatically pause when offscreen).

    Name

    Function

    Notes

    disableLifeCycleManagement(boolean disabled)

    Invoke to disable automatic management of banner

    Must be set to true for renderAd and setAdVisibility to work

    renderAd*

    Renders the ad if it is not visible

    It can also load new ad

    setAdVisibility*

    Notifies the view container when banner is visible screen

    Pause and resume banner

    destroyAd

    Call to destroy when no longer needed, the view container is no longer usable

    Frees banner resources

    finishAd*

    Stops current ad, send report and allow another ad to be loaded after (only applicable for certain integration into RecyclerView or ListView)

    Frees banner resources

    *Must invoke vungleBannerAd.disableLifeCycleManagement(true) before using this API

    Understanding Managed vs Un-managed

    When you get a VungleBanner by default it is a managed VungleBanner view. This means that the moment you add this view into a parent container, Vungle will take care of when to show an ad, and when to destroy an ad to send the report. Visibility events are also take care of and developers do not have to tell us when a banner view object is on screen or not. In cases where a developer will not have a VungleBanner view inside a recyclable view or ViewHolder pattern this is the preferred way to use VungleBanner.

    In cases in which a VungleBanner view is inside a ListView or RecyclerView, the managed VungleBanner will not work correctly. The moment the user scrolls the ad offscreen and scrolls back, the ad will be finished and no longer there.

    VungleBannerAdAdapter.java

    We added a disableLifeCycleManagement(boolean disable) to allow developers to be able to handle the lifecycle of the VungleBanner manually in these cases.

    When you set: (before you add the VungleBanner to a view or bind the view)

    vungleBannerAd.disableLifeCycleManagement(boolean disabled)

    You will have to call:

    VungleBanner.renderAd() when the view is bound

    VungleBanner.setAdVisibility(true|false) when the ad is recycled or no longer visible

    VungleBanner.destroyAd() when the VungleBanner object is no longer needed

    Best Practices

    Before attempting to show a banner ad always try to check if the parent activity is finishing before binding the VungleBanner to a view.

    if (activity != null && activity.isFinishing()) {

    return;

    }

    Do not change the LayoutParams of VungleBanner. This could negativity impact how the banner is displayed and result in your ad not being visible.

    Do not put the ad in a container size smaller than the requested ad. If youre requesting a regular banner (320x50) ensure that your parent container is at least 320dp x 50dp.

    Sample Code for Advanced Integration

    View Article
  • Please direct integration issues or Beta related bugs to [email protected]. Beta SDKs will not be supported upon beta testing completion. We recommend you update to the latest SDK version, once Beta testing is completed.

    Table of Contents

    Before You Get Started

    Requirements

    Sample App

    Download the SDK

    Step 1. Add the Vungle Framework to your Xcode Project

    Option 1. Cocoapods

    Option 2. ManualIntegration

    Add Other Required Frameworks

    Add The ObjC Linker Flag

    Step 2. Remove the iOS Status Bar

    Step 3. Add Code

    Initialize the SDK

    Load An Ad

    Check Ad Availability

    Play An Ad

    Native Ads

    In-Feed Ads

    Loading an In-Feed Ad

    Displaying an In-Feed Ad

    Closing an In-Feed Ad

    MREC Ads

    Loading an MREC Ad

    Displaying an MREC Ad

    Closing an MREC Ad

    Banner Ads

    Loading a Banner Ad

    Displaying a Banner Ad

    Closing a Banner Ad

    Delegate Callbacks

    Advanced Settings

    Customization Options

    Mute Option

    Memory Settings

    Restrict usage of IDFV

    GDPR Recommended Implementation Instructions

    Debug

    VungleSDKLogger Protocol

    Check Initialization State

    Before YouGet Started

    Requirements

    The Vungle iOS SDK v.6.5.0 supports Xcode 11 or higher as recommended byApple (see the reference document here ).

    Vungle iOS SDK v.6.5.0 supports applications that run on iOS 9 and higher. We do not recommend integrating the SDK in iOS versions lower than 9.0.

    The Vungle iOS SDK v.6.5.0 has been tested with the latest iOS version (iOS 13.0 as of release date).

    The Vungle iOS SDK v.6.5.0 supports 64-bit apps.

    Integration requires you tohave a Vungle account. If you don't yet have an account, create one before proceeding.

    We recommend using Xcode 11 to archive the app, as Xcode 10 will result in Invalid Bitcode version error.

    Sample App

    https://github.com/Vungle/iOS-SDK/tree/6.5.0

    Download the SDK

    https://vungle2-cdn-prod.s3.amazonaws.com/sdks/ios/early-access/vungle650-early.zip

    Step 1. Add the Vungle Framework to your Xcode Project

    Add the VungleSDK.framework to your Project

    There are two ways to add Vungle to your Xcode project: using Cocoapods or manual integration.

    Cocoapods

    The Vungle SDK is available through Cocoapods. Add Vungle to your project by adding the following lines into your projects podfile.

    source 'https://github.com/Vungle/ios-sdk-beta.git'pod "VungleSDK-iOS", "6.5.0"

    After that, a quick pod install run will update your project with the latest version of our iOS SDK. At this point you can skip down to Step 2. Remove the iOS Status Bar.

    Manual Integration

    Download Vungle SDK v6.5.0 If you are updating from a previous version of the Vungle SDK, first remove the VungleSDK.framework directory completely before adding the new SDK.

    Find the extracted files and drag the VungleSDK.framework directory into Xcode under Frameworks. Be sure to add the VungleSDK.framework folder as a group (yellow folder) and not as a reference (blue folder).

    Add Other Required Frameworks

    The Vungle SDK now ships with the build setting Link Frameworks Automatically set to YES, meaning you should no longer be required to link all the previously required frameworks and libraries (see below). With this update, you should only need to optionally link the following frameworks: included:

    CoreFoundation.framework

    Foundation.framework

    StoreKit.framework

    These previously required frameworks and libraries are included here so you can remove them if your project doesnt reference any of them:

    Support.framework

    AudioToolbox.framework

    AVFoundation.framework

    CFNetwork.framework

    CoreGraphics.framework

    CoreMedia.framework

    libz.dylib or libz.tbd

    MediaPlayer.framework

    QuartzCore.framework

    StoreKit.framework

    SystemConfiguration.framework

    Note: Vungle SDK v.6.5.0 does not support iOS 7. If you have iOS 7 as a deployment target, use Vungle iOS SDK v.4.1 or lower, and include these frameworks:

    UIKit.framework

    WebKit.framework

    Foundation.framework

    Make sure that the VungleSDK framework appears under Linked Frameworks and Libraries.

    Add the -ObjC Linker Flag

    Click on your project in Project Navigator and go to Build Settings Linking Other Linker Flags. Add -ObjC to Other Linker Flags.

    Step2.RemovetheiOSStatusBar

    Although this step is not required, we recommend that you remove the iOS status bar to ensure that Vungle's ad interaction and presentation perform smoothly. To remove the status bar, open your Info.plist, add the key View controller-based status bar appearance, and set it to No.

    Step3.AddCode

    Initialize the SDK

    Initialize the SDK as soon as your app starts; if you are using a cache-optimized placement, doing this gives the SDK enough time to cache an ad for that placement. You will need the App ID to initialize the SDK. You can find the App ID in the Vungle Dashboard.

    - (BOOL)startWithAppId:(nonnull NSString *)appID error:(NSError **)error;

    Sample code:

    #import <VungleSDK/VungleSDK.h>

    ...

    NSError* error;

    NSString* appID = @"Your_AppID_Here";

    VungleSDK* sdk = [VungleSDK sharedSDK];

    if (![sdk startWithAppId:appID error:&error]) { if (error) { NSLog(@"Error encountered starting the VungleSDK: %@", error); }}

    Once the SDK is initialized successfully, the following callback method is called:

    - (void)vungleSDKDidInitialize;

    Refer to the Delegate Callbacks section of this article.

    You can also check the status of the SDK initialization with the following property:

    @property (atomic, readonly, getter=isInitialized) BOOL initialized;

    Since Vungle SDK v.6.4.3, after initialization we will automatically optimize the caching behaviors to maximize your monetization performance.

    Once initialization is successful, watch for the vungleAdPlayabilityUpdate callback method to be called with the placement reference IDs matching your cache-optimized placement. (Refer to the Check Ad Availability for a Placement )

    Load an Ad for a Placement

    To load an ad, you will need to call loadPlacementWithID method:

    - (BOOL)loadPlacementWithID:(NSString *)placementID error:(NSError **)error;

    Sample code:

    NSError* error;

    VungleSDK* sdk = [VungleSDK sharedSDK];

    NSString* placementID = @"Your_placement_ID_Here";VungleSDK* sdk = [VungleSDK sharedSDK];if (![sdk loadPlacementWithID:placementID error:&error]) { if (error) { NSLog(@"Error occurred when loading placement: %@", error); }}

    Check Ad Availability for a Placement

    Once the SDK finishes caching an ad for a placement, the following callback method is called:

    - (void)vungleAdPlayabilityUpdate:(BOOL)isAdPlayable placementID:(nullable NSString *)placementID error:(nullable NSError *)error;

    Sample code:

    - (void)vungleAdPlayabilityUpdate:(BOOL)isAdPlayable placementID:(NSString *)placementID error:(nullable NSError *)error {

    if([placementID isEqualToString:@"Your_placement_ID_Here"]) {

    self.playButtonPlacement1.enabled = isAdPlayable;

    }

    }

    Note: For the cache-optimized placements, only when an ad becomes available is this callback method called. The SDK will keep requesting an ad for these placements. For all other placements, this callback method is called in case of Load Failed (isAdPlayable returns NO in this case).

    You can also check the ad availability for a placement with the following property:

    - (BOOL)isAdCachedForPlacementID:(nonnull NSString *)placementID;

    Play an Ad

    After you make sure that an ad is ready for a placement, you can play the ad with the following method:

    - (BOOL)playAd:(UIViewController *)controller options:(nullable NSDictionary *)options placementID:(nullable NSString *)placementID error:( NSError *__autoreleasing _Nullable *_Nullable)error;

    Sample Code:

    VungleSDK* sdk = [VungleSDK sharedSDK];NSError *error;if (![sdk playAd:self options:nil placementID:@"Your_placement_ID_Here" error:&error]) { if (error) { NSLog(@"Error encountered playing ad: %@", error); }}

    Native Ads

    In-Feed Ads

    Since Vungle SDK v.5.3, we support In-Feed ads. This is the first ad format that does not require a full screen; instead, the publisher determines the exact dimensions and location of the ad container within their app. These ad containers can be in collection views or table views.

    Loading an In-Feed Ad

    Loading a In-Feed ad is the same as loading a fullscreen ad; however, the placement must be configured to support In-Feed. Contact your Vungle account manager to enable In-Feed for a placement.

    Displaying an In-Feed Ad

    Displaying In-Feed ads differs from displaying fullscreen ads. With In-Feed ads, you must first create a container for the ad. This container is a UIView. You can place said UIView anywhere on the screen. The ad will scale to any size of container, but keep in mind that very low resolution will make ads less visible. You must then call the addAdViewToView function to associate the container with the In-Feed ad.

    Note: If the UIView created for the In-Feed ad is created in Interface Builder, you should create a local UIView instance (of the same width and height as the IB view) and add that as a subview to the Interface Builder view. This will allow you to add and remove the In-Feed view and reuse the In-Feed UIView container as needed.

    Function overview:

    /**

    * Pass in an UIView which acts as a container for the ad experience. This view container may be placed in random positions.

    * @param publisherView container view in which an ad will be displayed

    * @param options A reference to an instance of NSDictionary with customized ad playback options

    * @param placementID The placement defined on the Vungle dashboard

    * @param error An optional double reference to an NSError. In case this method returns `NO` it will be non-nil

    * @return YES/NO in case of success/error while presenting an AdUnit

    */

    - (BOOL)addAdViewToView:(UIView *)publisherView withOptions:(nullable NSDictionary *)options placementID:(nullable NSString *)placementID error:( NSError *__autoreleasing _Nullable *_Nullable)error;

    Sample code:

    NSError *error;NSDictionary *options = @{};VungleSDK* sdk = [VungleSDK sharedSDK];@property (strong, nonatomic) UIView *tempIn-FeedFeedView;// Play a Vungle ad (with default options) if (!self.tempIn-FeedFeedView) { // This view has the same size as the corresponding view created in interface builder self.tempIn-FeedFeedView = [[UIView alloc] initWithFrame:self.In-FeedFeedView.bounds]; } // add temp view as subview to view created in Interface Builder [self.In-FeedFeedView addSubview:self.tempIn-FeedFeedView]; NSError *error; [self.sdk addAdViewToView:self.tempIn-FeedFeedView withOptions:nil placementID:placementID error:&error];if (![sdk addAdViewToView:_In-FeedFeedViewArea withOptions:options placementID:@"Your_placement_ID_Here" error:&error]) { if (error) { NSLog(@"Error encountered while playing an ad: %@", error); }}

    Closing an In-Feed Ad

    Due to the nature of In-Feed ads, a user can stop viewing the video without closing the ad. You must therefore tell the SDK to dismiss the ad when it is no longer on screen. To do this, call the finishedDisplayingAd function. This function only works with MREC and In-Feed ads. Note that this function does not take in a placement; it will simply close any native ad currently playing.Depending on the implementation, you may need to include some cleanup (removing the In-Feed container UIView from its parent view, etc.).

    Function overview:

    /**

    * This method must be called when the publisher is confident that they are finished displaying the ad unit.

    * This signals to the SDK that a new ad may be fetched or a different ad may be displayed. This will

    * be called in conjunction with `addViewToView:containedInViewController:withOptions:placementID:error:`

    */

    - (void)finishedDisplayingAd;

    Sample code:

    //Ad is no longer on screen

    VungleSDK* sdk = [VungleSDK sharedSDK];

    [sdk finishedDisplayingAd];[self.tempIn-FeedFeedView removeFromSuperview];self.tempIn-FeedFeedView = nil;

    Note: Only one In-Feed Ad should be playing at a time. Hence you should make sure you dismiss any In-Feed Ad before attempting to play another ad.

    MREC Ads

    Since Vungle SDK v.6.4.3, we support MREC ads. Similarly to In-Feed ads, this ad format does not require a full screen; instead, the publisher determines the location of the ad container within their app. However, the size of the MREC container has to be 300 250, which is the industry standard.

    Loading an MREC Ad

    Similarly to In-Feed, the placement type for MREC has to have the type MREC in Vungle dashboard.

    Displaying an MREC Ad

    Similarly to In-Feed ads, you must first create a container for the MREC ads. This container is aUIViewhaving the size of 300 250. You can place saidUIView anywhere on the screen. You must then call theaddAdViewToViewfunction to associate the container with the MREC ad.

    Function overview:

    /** * Pass in an UIView which acts as a container for the ad experience. This view container may be placed in random positions. * @param publisherView container view in which an ad will be displayed * @param options A reference to an instance of NSDictionary with customized ad playback options * @param placementID The placement defined on the Vungle dashboard * @param error An optional double reference to an NSError. In case this method returns `NO` it will be non-nil * @return YES/NO in case of success/error while presenting an AdUnit */- (BOOL)addAdViewToView:(UIView *)publisherView withOptions:(nullable NSDictionary *)options placementID:(nullable NSString *)placementID error:( NSError *__autoreleasing _Nullable *_Nullable)error;

    Sample code:

    NSError *error;NSDictionary *options = @{};VungleSDK* sdk = [VungleSDK sharedSDK];if (![sdk addAdViewToView:_mrecViewArea withOptions:options placementID:@"Your_placement_ID_Here" error:&error]) { if (error) { NSLog(@"Error encountered while playing an ad: %@", error); }}

    Closing an MREC Ad

    Similarly to In-Feed ads, to close an MREC ad, call thefinishedDisplayingAd function. This function only works with MREC and In-Feed ads. Note that this function does not take in a placement; it will simply close any native ad currently playing. Depending on the implementation, you may need to include some cleanup (removing the In-Feed container UIView from its parent view, etc).

    Function overview:

    /**

    * This method must be called when the publisher is confident that they are finished displaying the ad unit.

    * This signals to the SDK that a new ad may be fetched or a different ad may be displayed. This will

    * be called in conjunction with `addViewToView:containedInViewController:withOptions:placementID:error:`

    */

    - (void)finishedDisplayingAd;

    Sample code:

    //Ad is no longer on screen

    VungleSDK* sdk = [VungleSDK sharedSDK];

    [sdk finishedDisplayingAd];

    Banner Ads

    Since Vungle SDK v.6.5.0, Vungle support Banner ads. Similarly to other native ads, this ad format does not require a full screen; instead, the publisher determines the location of the ad container within their app. However, the size of the Banner container has to be 320x50, 300x50 or 728x90 (for tablets). Banner ads can be set anywhere on the screen and the user can continue using the app while the ad is being played. Enum associated for the different banner sizes can be found in VungleSDK.h file (also described in the table below)

    Banner ENum

    Dimension

    VungleAdSizeBanner

    320*50

    VungleAdSizeBannerShort

    300*50

    VungleAdSizeBannerLeaderboard

    728*90

    Similarly to In-Feed or MREC ads, the placement type for Banner has to have the type Banner in Vungle dashboard. Feel free to contact your account manager to enable Banner placement on the dashboard.

    Loading a Banner Ad

    Loading a banner ad works different than other ad formats. Use the belowAPI to load the banner ad. You would need to specify size of the banner that you want to load and SDK will automatically refresh it with the time interval that you configured on the dashboard. Refer the above table for enum values that is required by the load call.

    Function overview:

    /**

    * (Overloaded method)

    * Prepares a placement when you know that you will want

    * to show an ad experience tied to a specific placementID.

    * @param placementID the specific ID of the placement you would like to present at some point soon

    * @param size the VungleAdSize (enum) you would like to request (only for banner ad type at the moment)

    * @return NO if something goes immediately wrong with loading, YES otherwise

    */

    - (BOOL)loadPlacementWithID:(NSString *)placementID withSize:(VungleAdSize)size error:(NSError **)error;

    Sample code:

    NSError* error;

    VungleSDK* sdk = [VungleSDK sharedSDK];

    if (![sdk loadPlacementWithID:@"Your_placement_ID_Here" withSize:BANNER_ENUM error:&error]) { if (error) { NSLog(@"Error occurred when loading placement: %@", error); }}

    You can also check for the banner ad availability by calling the below API.

    Function overview:

    /**

    * (Overloaded method)

    * Returns `YES` when there is certainty that an ad will be able to play for a given placementID.

    * Returning `NO`.

    * @param size the VungleAdSize (enum) you would like to request (only for banner ad type at the moment)

    * @param placementID the specific ID of the placement you are trying to present

    */

    - (BOOL)isAdCachedForPlacementID:(nonnull NSString *)placementID withSize:(VungleAdSize)size;

    Sample code:

    if([sdk isAdCachedForPlacementID:@"Your_placement_ID_Here" withSize:BANNER_ENUM]){ //Ad is cached successfully}

    Displaying a Banner Ad

    Similarly to other native ads, you must first create a container for the banner ads. This container is aUIViewhaving the size of 300 250, 320*50 or 728*90 (for iPads only) . You can place the saidUIView anywhere on the screen. You must then call theaddAdViewToViewfunction to associate the container with the banner ad.

    Function overview:

    /**

    * Pass in an UIView which acts as a container for the ad experience. This view container may be placed in random positions.

    * @note This method should only be called using placements that have the `flexfeed` or `mrec` template type. ALSO, for the

    *`mrec` template type, note that the UIView must have a width of 300 and a height of 250. If the view is provided without

    * these dimensions, an error message will be returned and the ad will not be shown.

    * @param publisherView container view in which an ad will be displayed

    * @param options A reference to an instance of NSDictionary with customized ad playback options

    * @param placementID The placement defined on the Vungle dashboard

    * @param error An optional double reference to an NSError. In case this method returns `NO` it will be non-nil

    * @return YES/NO in case of success/error while presenting an AdUnit

    */

    - (BOOL)addAdViewToView:(UIView *)publisherView withOptions:(nullable NSDictionary *)options placementID:(nullable NSString *)placementID error:(NSError *__autoreleasing _Nullable *_Nullable)error;

    Sample code:

    NSError *error;NSDictionary *options = @{};VungleSDK* sdk = [VungleSDK sharedSDK];if (![sdk addAdViewToView:_bannerViewArea withOptions:options placementID:@"Your_placement_ID_Here" error:&error]) { if (error) { NSLog(@"Error encountered while playing an ad: %@", error); }}

    Closing a Banner Ad

    Similarly to other native ads, callfinishedDisplayingAdfunction to close the banner ad. Note that, as mentioned for other native ads, this function does not take in a placement; it will simply close any native ad currently playing. Depending on the implementation, you may need to include some cleanup (removing the banner container UIView from its parent view, etc).

    Function overview:

    /**

    * This method will dismiss the currently playing an In Feed,MREC or Banner advertisement. If you have added an advertisement with `addAdViewToView:`

    * or you are playing a placement that has been configured as an In Feed, MREC or Banner placement, then this method will remove the advertisement

    * from the screen and perform any necessary clean up steps.

    *

    * This method will call the existing delegate callbacks as part of the lifecycle.

    */

    - (void)finishedDisplayingAd;

    Sample code:

    VungleSDK* sdk = [VungleSDK sharedSDK];

    [sdk finishedDisplayingAd];

    Delegate Callbacks

    You can receive callbacks from the SDK with VungleSDKDelegate. The callback methods in the delegate notify the app about SDK events.

    You can attach and detach your delegate with:

    // Attach

    [[VungleSDK sharedSDK] setDelegate:yourDelegateInstance];

    // Detach

    [[VungleSDK sharedSDK] setDelegate:nil];

    Note: Remember to clear the registered delegate when it's no longer needed to avoid memory leaks.

    The following method is called when the SDK has initialized successfully:

    - (void)vungleSDKDidInitialize;

    The following method is called when the SDK is about to play a video ad. This is a great place to pause gameplay, sound effects, animations, etc.

    - (void)vungleWillShowAdForPlacementID:(nullable NSString *)placementID;

    The following method is called when the SDK is just begun to play a video ad.

    - (void)vungleDidShowAdForPlacementID:(nullable NSString *)placementID;

    The following method is called when the SDK is about to close an ad. This is a great place to reward your user and resume gameplay, sound effects, animations, etc.

    - (void)vungleWillCloseAdWithViewInfo:(VungleViewInfo *)info placementID:(NSString *)placementID;

    The following method is called when the SDK has closed an ad:

    - (void)vungleDidCloseAdWithViewInfo:(VungleViewInfo *)info placementID:(NSString *)placementID;

    VungleViewInfo includes the following properties for you to check a result of ad play:

    @interface VungleViewInfo : NSObject

    //Represents a BOOL whether or not the video can be considered a completed view.

    @property (nonatomic, readonly) NSNumber *completedView;

    //The time in seconds that the user watched the video.

    @property (nonatomic, readonly) NSNumber *playTime;

    //Represents a BOOL whether or not the user clicked the download button.

    @property (nonatomic, readonly) NSNumber *didDownload;

    @end

    The following method is called when the SDK has changed ad availability status. The isAdPlayable boolean denotes the new playability of a specific placementID.

    - (void)vungleAdPlayabilityUpdate:(BOOL)isAdPlayable placementID:(nullable NSString *)placementID error:(nullable NSError *)error;

    (Please refer to Check Ad Availability for a Placement.)

    The following method is called when the SDK fails to initialize. If this happens, youll need to restart the Vungle SDK.

    - (void)vungleSDKFailedToInitializeWithError:(NSError *)error;

    Advanced Settings

    Customization Options

    Use these options to customize the ad experience for playback.

    Note:Rewardedads are in some cases referred to asincentivizedads; both terms always refer to the same kind of ad. In the SDK code and in our Reporting API, we use the term 'incentivized'.

    Option Keys

    Default Value / Type

    Description

    VunglePlayAdOptionKeyOrientations

    autorotate

    UIInterfaceOrientationMaskAll

    An NSNumber representing a bitmask with orientations

    Sets the orientation of the ad. We recommend allowing ads to autorotate, even if your app is in portrait. This way, the user has the option to watch full-size videos, resulting in a better user experience. You can achieve this by setting the orientation on a view controller level (rather than a project level).

    VunglePlayAdOptionKeyUser

    nil

    NSString

    Sets your user ID. The value is passed to Vungle server, and then sent to your server through server-to-server callback system if an placement is set to Rewarded.

    VunglePlayAdOptionKeyIncentivizedAlertTitleText

    nil

    NSString

    String that is used as the title of the alert dialog presented when a user closes a rewarded ad experience prematurely.

    VunglePlayAdOptionKeyIncentivizedAlertBodyText

    Are you sure you want to skip this ad? If you do, you might not get your reward

    NSString

    String that is used as the body text of the alert dialog presented when a user closes a rewarded ad experience prematurely.

    VunglePlayAdOptionKeyIncentivizedAlertCloseButtonText

    Close

    NSString

    String title for the close button text of the alert dialog presented when a user closes a rewarded ad experience prematurely.

    VunglePlayAdOptionKeyIncentivizedAlertContinueButtonText

    Continue

    NSString

    String title for the close button text of the alert dialog presented when a user closes a rewarded ad experience prematurely.

    VunglePlayAdOptionKeyFlexViewAutoDismissSeconds

    Int

    Use this option to make Flex View ads dismiss automatically after the specified number of seconds. This function only works with Flex View ads.

    VunglePlayAdOptionKeyOrdinal

    Int

    If you receive ordinal data reports from Vungle, use this field to pass the mediation ordinal. This is an integerindicating the order in which this ad was shown in the game session (for example, if two ads were already shown in this session, and this ad from Vungle was then shown third, pass in '3'). Read more about ordinal data here.

    Sample Code

    NSDictionary *options = @{VunglePlayAdOptionKeyOrientations: @(UIInterfaceOrientationMaskLandscape),

    VunglePlayAdOptionKeyUser: @"userGameID",

    VunglePlayAdOptionKeyIncentivizedAlertBodyText : @"If the video isn't completed you won't get your reward! Are you sure you want to close early?",

    VunglePlayAdOptionKeyIncentivizedAlertCloseButtonText : @"Close",

    VunglePlayAdOptionKeyIncentivizedAlertContinueButtonText : @"Keep Watching",

    VunglePlayAdOptionKeyIncentivizedAlertTitleText : @"Careful!"};

    // Pass in dict of options, play ad

    NSError *error;

    [self.sdk playAd:self options:options placementID: error:&error];

    if (error) {

    NSLog(@"Error encountered playing ad: %@", error);

    }

    Mute Option

    The Vungle SDK instance offers the option to play ads with the sound disabled. You can set the muted property to true before issuing a playAd().

    Sample code:

    VungleSDK* sdk = [VungleSDK sharedSDK];

    self.sdk.muted = true;

    Note:This option only applies to the standard ad type for SDK version 6.3.1 and below. The muted option for Dynamic Template ads is available to configure on the dashboard. v6.3.2 will respect SDK side mute setting for all ads.

    Memory Settings

    Starting from v6.4.3, you can prevent the SDK from downloading, requesting ads or even initializing if the storage of your iPhone falls below a predefined threshold. If this happens, you will get an error similar to the following:

    Error while starting VungleSDK There is not enough file system size on a device to initialize VungleSDK.

    These are the option keys available:

    Option Keys

    Default Value / Type

    Description

    vungleMinimumFileSystemSizeForInit

    Integer, value in MB, default value is 50

    Sets the required minimum available free storage space to be able to initialize the SDK

    vungleMinimumFileSystemSizeForAdRequest

    Integer, value in MB, default value is 50

    Sets the required minimum available free storage space to be able to request an ad

    Sample code:

    [[NSUserDefaults standardUserDefaults] setInteger:200 forKey:@"vungleMinimumFileSystemSizeForInit"];[[NSUserDefaults standardUserDefaults] setInteger:200 forKey:@"vungleMinimumFileSystemSizeForAdRequest"]; //After setting the desired values above, synchronize[[NSUserDefaults standardUserDefaults] synchronize];

    Restrict usage of IDFV

    Starting from v6.4.3, you can now restrict from passing the IDFV from the device to the SDK.

    Sample code:

    [VungleSDK setPublishIDFV:NO];

    if (![sdk startWithAppId:appID error:&error]) {

    if (error) {

    NSLog(@"Error encountered starting the VungleSDK: %@", error);

    }

    }

    GDPR Recommended Implementation Instructions

    As of May 25th 2018, the General Data Protection Regulation (GDPR) will be enforced in the European Union. To comply with GDPR, developers have two options.

    Option 1 (recommended): Publisher controls the GDPR consent process at the user level, then communicates the users choice to Vungle. To do this, developers can collect the users consent using their own mechanism, and then use Vungle APIs to update or query the users consent status. Refer to the GDPR Recommended Implementation Instructions section for details.

    Option 2: Allow Vungle to handle the requirements. Vungle will display a consent dialog before playing an ad for a European user, and will remember the users consent or rejection for subsequent ads.

    To use Vungle APIs to update or query the users consent status (as recommended in Option 1), use these functions for v6.3.2 and above:

    // This function sets the consent status that will be recorded in Vungle SDK. Accepted values: 'VungleConsentAccepted' or 'VungleConsentDenied'. It also sets the consent message version. This value is an arbitrary string, and can be used to identify the version of the consent message presented to the user.

    // To set the user's consent status to opted in:

    [[VungleSDK sharedSDK] updateConsentStatus:VungleConsentAccepted consentMessageVersion:@"Some Consent Message Version"];

    // To set the user's consent status to opted out:

    [[VungleSDK sharedSDK] updateConsentStatus:VungleConsentDenied consentMessageVersion:@"Some Consent Message Version"];

    // To find out what the user's current consent status is:

    // (Check against enum values: 'VungleConsentAccepted' or 'VungleConsentDenied'.)

    [[VungleSDK sharedSDK] getCurrentConsentStatus];

    // To find out which version of the consent message was shown to the user:

    // This method returns an NSString value.

    [[VungleSDK sharedSDK] getConsentMessageVersion];

    VungleConsentStatus is an enum containing of two states:

    VungleConsentAccepted

    VungleConsentDenied

    The SDK also has an initial state of 'unknown', which prompts the user to opt in or opt out of user data collection. Note that this prompt only occurs on IP addresses originating from Europe.

    v6.2.0 does not have ability to pass consent message version, so please use following APIs.

    // This function sets the consent status that will be recorded in Vungle SDK. Accepted values: 'VungleConsentAccepted' or 'VungleConsentDenied'.

    // To set the user's consent status to opted in:

    [[VungleSDK sharedSDK] updateConsentStatus:VungleConsentAccepted]

    // To set the user's consent status to opted out:

    [[VungleSDK sharedSDK] updateConsentStatus:VungleConsentDenied];

    // To find out what the user's current consent status is:

    // (Check against enum values: 'VungleConsentAccepted' or 'VungleConsentDenied'.)

    [[VungleSDK sharedSDK] getCurrentConsentStatus];

    Debug

    If you need SDK information, you can get it by using this property:

    - (NSDictionary *)debugInfo;

    If you want the SDK to output logs, use the following method:

    - (void)setLoggingEnabled:(BOOL)enable;

    VungleSDKLogger Protocol

    @protocol VungleSDKLogger

    - (void)vungleSDKLog:(NSString*)message;

    @end

    The VungleSDK singleton sends logging events to any attached class following the VungleSDKLogger protocol. The log event contains the NSString value that is also printed to console (if logging has been enabled). To attach your logger, use the following:

    [[VungleSDK sharedSDK] attachLogger:yourLoggerInstance];

    As mentioned above, it's important to clear out attached loggers from the Vungle SDK. Loggers can be detached using the following approach:

    [[VungleSDK sharedSDK] detachLogger:yourLoggerInstance];

    Check Initialization State

    Some of the resources allocated to Vungle SDK can be terminated by OS if system resources are running low or many context switching take place. We recommend checking SDK initialization state before invoking SDK API to ensure smooth operation of SDK.Invoke isInitialized before calling any SDK API and re-initialize SDK if it returns NO.

    if ([self.sdk isInitialized] == NO) {

    [self initVungleSDK];

    }

    View Article
  • Please direct integration issues or Early Access SDK related bugs to [email protected] Access SDKs will not be supported upon Early Access testing completion. We recommend you update to the latest SDK version, once Early Access testing is completed.

    Use this guide to add VungleiOS SDK into yourapp, usingAdMob as yourmain advertising mediation layer.

    AdMob iOS adapter v6.5.0.0 is compatible with Vungle iOS SDK v6.5.0 and is tested with Google SDK v7.50.0

    Download AdMob iOS Adapter v6.5.0.0 and include Vungle SDK 6.5.0, then add them to your project manually.

    Vungle iOS SDK is also available through CocoaPods. Add the following line in your project's pod file followed by aquick pod install runto update the project with the version of Vungle iOS SDK.

    source 'https://github.com/Vungle/ios-sdk-beta.git'pod "VungleSDK-iOS", "6.5.0"

    Contents

    Before you get Started

    Setup

    Ad Format

    IDFV

    Memory Settings

    New Rewarded API

    Before YouGet Started

    Ad units set up on AdMob dashboard.

    Vungle App ID and Placement IDs created on Vungle dashboard and placement IDs are linked to ad units on AdMob dashboard.

    Set up the application with the right XCode and iOS SDK version as detailed in the Vungle iOS integration document

    Note:

    Refer AdMob's integration document for detailed steps to setup Ad units and link Vungle's Placement IDs to ad units on AdMob dashboard.

    Setup

    Before you begin to test the new adapter:

    Integrate the application with the latest adapter files and Vungle SDK.

    Update the Google Mobile Ads SDK to the latest version in the project.

    Ad Format

    Starting v6.5.0, we have expanded support for AdMobs Banner Ads and support following 3 sizes:

    Size in points (WxH)

    Description

    AdSize constant

    320x50

    Banner

    kGADAdSizeBanner

    728x90

    IAB leaderboard

    kGADAdSizeLeaderboard

    300x250

    IAB medium rectangle

    kGADAdSizeMediumRectangle

    To display banner ad in the application, create an MREC placement on Vungle dashboard and link this placement to a Banner Ad unit on AdMob dashboard.

    Presently, Vungle supports banner size 300*250 and should be specified as kGADAdSizeMediumRectangle as ad constant size in the implementation.

    Sample Code:

    GADBannerView *bannerView = [[GADBannerView alloc] initWithAdSize:kGADAdSizeMediumRectangle];

    [self addBannerViewToView:self.bannerView];

    Loading, playing and closing the banner ad is detailed in the AdMob integration guide.

    IDFV

    For SDK version 6.4.x onwards, publishers can now restrict from passing IDFV from the device to the SDK.

    Sample Code:

    //Set the bool value YES to pass the IDFV from device to SDK

    [VungleRouterConfiguration setPublishIDFV:YES];

    //Set the bool value NO to disable the IDFV collection from device to SDK

    [VungleRouterConfiguration setPublishIDFV:NO];

    Memory Settings

    Starting from v6.4.x, you can prevent the SDK from requesting ads or even initializing if the storage of your iPhone falls below a predefined threshold.

    Sample Code:

    //Integer value sets the required minimum available free storage space to be able to initialize the SDK

    [VungleRouterConfiguration setMinSpaceForInit:];

    //Integer value sets the required minimum available free storage space to be able to request an Ad

    [VungleRouterConfiguration setMinSpaceForAdLoad:];

    New Rewarded API

    As documented by AdMob, starting from version 7.42.2 or higher, AdMobs Rewarded Ads (New APIs), lets you cache multiple ads at the same time for a single ad unit.

    Since Vungle does not support this feature, the Ad request for the second Load ad will not be filled by Vungle, rather it will be passed to the next ad network in the waterfall.

    View Article
  • Our testing options allow you to make sure SDK integration and placement configuration are optimal for monetization without disrupting your user experience or your apps. There are two ways you can test Vungle Ads via the Publisher Self-Serve UI. Based on your specific scenario in the SDK integration process, you may want to utilize one and/or the other.

    Heads Up

    While youre testing ads, you will receive a selection of catered test ads for non-live applications. Due to the small pool of test ads, these ads will repeat on a frequent cycle.

    Test Mode

    Setting your application to test mode (orange orb) is beneficial if you have not set your app live in the app store and are simply ensuring our SDK is properly integrated for the first time. If your app is in test mode, you will not be able to download any of the apps advertised while testing. Additionally, the Publisher Self-Serve Platform will not report on these tests, and you will not receive revenue. Test ads are used only to verify that you have integrated the SDK correctly. This reporting functionality becomes available once your app has been switched to active mode (green orb). When an application is set to test mode, test ads will be delivered to all devices.

    Using the Test Mode Feature:

    Go to your publisher self-serve platform.

    Select the app you need to test with from either the left navigation or the Applications page.

    Click Edit App Settings or App Settings.

    In the Overview tab for the Status field, select Test Mode (receiving test ads).

    Click Save.

    Where do I find this?

    Note

    Once test mode is enabled, it may take up to 30 minutes to reflect changes and serve test ads to all your devices. You MUST turn off test mode before going active in our platform or else your app will fail to monetize. Test ads will only reflect some dashboard settings; however, advanced features will not be reflected.Interstitial and Rewarded placement types are only supported.

    Test Devices

    Vungles Test Device feature is primarily useful when you are already monetizing with Vungle and your application is set to active but wish to test out a newly integrated Vungle SDK prior to setting your updated application version live in its respective app store. Its beneficial if you want to selectively turn on test traffic for a set of devices as you already have a prior version of the SDK integrated for this particular app, thereby restricting your testing to only a few devices.

    When an app is moved to active, test ads will be delivered to the device whose IDFA/ GAID is entered and saved in the Publisher Self-Serve Platform, which enables your devices to receive test ads on QA devices while mobile end-users will continue to receive live ads from your live application in the particular store.

    Applications advertised in the test ads via the test devices added will not be able to be downloaded. Additionally, the Publisher Self-Serve Platform will not report on these tests and you will not receive revenue. This is because test ads are used only to verify that you have integrated the SDK correctly.

    Using the Test Device Feature:

    Go to your publisher self-serve platform.

    Select the app you need to test with from either the left navigation or the Applications page.

    Click Edit App Settings or App Settings.

    Select the Test Devices tab.

    Name your test device and add its IDFA or GAID.

    Click Add to add this device. You can add more devices if you want.

    Vungle will now read your devices ID and send test ads to that device.

    Click the trash icon to remove a test device.

    Note

    Once enabled it may take up to 30 minutes to reflect changes and serve test ads to all your devices. Test ads that run will only reflect some dashboard settings, as advanced features will not be reflected. Interstitial and Rewarded placement types are only supported.

    View Article
  • "App-ads.txt: How to Make It & Why You Need It"

    Last year, the ad tech industry struck back at one of its most elusive problems widespread domain spoofing that let unauthorized developers sell premium inventory they didnt actually have. The solution? Over two million developers adopted ads.txt a simple-text public record of Authorized Digital Sellers for a particular publishers inventory to make sure they didnt lose money from DSPs and programmatic buyers who avoid noncompliant publishers. Thanks to buyers ability to crawl ads.txt and verify seller authenticity, this has quickly become a standard for protecting brands. Ad fraud reduced by 11% in 2019 due to these efforts and publishers ability to implement more fraud prevention techniques.

    The time has come for ads.text to evolve in-app. The introduction of apps-ads.txt is an important method for mobile app devs to similarly eliminate fraud and improve transparency.

    What is app-ads.txt?

    Like ads.txt, apps-ads.txt is a text file that app devs upload to their publisher website. It lists all ad sources authorized to sell that publishers inventory. The IAB created a system that allows buyers to distinguish the authorized sellers for specific in-app inventory, weeding out the undesirables.

    How does app-ads.txt work for mobile apps?

    A DSP wanting to bid on an apps inventory crawls the app-ads.txt file on a developers website to verify which ad sources are authorized to sell that apps inventory. The DSP will only accept bid requests from ad sources listed on the file and authorized by the app developer.

    How does app-ads.txt help mobile app developers capture more ad revenue?

    Authorized in-app inventory. An ever-increasing amount of brands are looking to advertise in-app today. Brand buyers now rely on an adherence to app-ads.txt to make sure theydon'tbuy unauthorized inventory from app developers and negatively impact campaign performance. Developers whodon'timplement app-ads.txt can be removed from any brand buyers target media list. Thats why joining the app-ads.txt movement is crucial for publishers to maintain their revenue.

    Ad fraud prevention. App-ads.txt blocks unauthorized developers who impersonate legitimate apps and mislead DSPs into spending brand budgets on fake inventory. With fraud instances minimized, authentic developers can retain more of the ad revenue from inventory genuinely targeted to their app.

    How do I create an app-ads.txt?

    **You must list your Developer Website URL in the GooglePlay and iTunes app stores. There must be a valid developer website URL in all app stores hosting your apps.**

    Step 1: Provide the publisher website URL in your app store listing.

    Make sure that your publisher website URL (not app specific URL) is added in your app store listings. Advertising platforms will use this site to verify the app-ads.txt file. Also, double-check that your ad network (e.g. Vungle) account also has the correct app store URL for your app.

    Step 2: Reach out to all ad sources (direct, resellers, et cetera).

    Get in touch with your direct ad sources and ask for their app-ads.txt line according to the IABs structure below:

    Ad source domain, your publisher account ID, type of relationship (direct or reseller), TAG cert ID

    Example: vungle.com, 1234, DIRECT, 5678

    If your partners are using third-party resellers to sell your inventory, they should be listed as reseller.

    Example: vungle.com, 1234, RESELLER, 6789

    (You shouldnt add any provider to your app-ads.txt file unless you or your partner have a direct relationship with them.)

    We have made it easier for you to include Vungles list of entries so thatdon'thave to construct it on your own. Please copy and paste the following text block and include in your txt file along with entries you may have from your other monetization partners:

    vungle.com, [yourVunglePublisherAccountID], DIRECT, c107d686becd2d77openx.com, 540280728, RESELLER, 6a698e2ec38604c6appnexus.com, 10128, RESELLER, f5ab79cb980f11d1indexexchange.com, 185774, RESELLER, 50b1c356f2c5c8fcloopme.com, s-2411, RESELLER, 6c8d5f95897a5a3bloopme.com, 10999, RESELLER, 6c8d5f95897a5a3brubiconproject.com, 13626, RESELLER, 0bfd66d529a55807

    Remember to replace [yourVunglePublisherAccountID] with your Vungle Account ID, which can be found in your Vungle account management dashboard.

    Step 3: Write the app-ads.txt file.

    Create and save an app-ads.txt file in any text editor (e.g. Notepad) listing out all the lines you received from your ad source partners.

    Step 4: Upload the app-ads.txt file.

    Upload the app-ads.txt file to the root of your website domain (e.g. https://www.example.com/app-ads.txt).

    To sum up...

    Vungle is committed to more transparency and security in the mobile advertising ecosystem. Its important both ad networks and developers do their part to participate in this movement to help remove fraud. We encourage all our developers to adopt app-ads.txt so they stay healthy on our network and earn the revenue they deserve.

    Still have questions?

    Please submit a technical support request !

    View Article
  • Contents

    Before You Get Started

    Step 1. Add the Vungle Framework to your Xcode Project

    Step 2. Remove the iOS Status Bar

    Step 3. Add Code

    Before YouGet Started

    The Vungle iOS SDK v.6.4.6 supports Xcode 11 or higher.

    Vungle iOS SDK v.6.4.6 supports applications that run on iOS 9 and higher. We do not recommend integrating the SDK in iOS versions lower than 9.0.

    The Vungle iOS SDK v.6.4.6 has been tested with the latest iOS 13.

    The Vungle iOS SDK v.6.4.6 supports 64-bit apps.

    Integration requires you tohave a Vungle account. If you don't yet have an account, create one before proceeding.

    We recommend using Xcode 11 to archive the app, as Xcode 10 will result in "Invalid Bitcode version error".

    Sample App

    https://github.com/Vungle/iOS-SDK/tree/master

    Step 1. Add the Vungle Framework to your Xcode Project

    Add the VungleSDK.framework to your Project

    There are two ways to add Vungle to your Xcode project: using Cocoapods or manual integration.

    Cocoapods

    The Vungle SDK is available through Cocoapods. Add Vungle to your project by adding the following line into your projects podfile.

    pod "VungleSDK-iOS", "6.4.6"

    After that, a quick pod install run will update your project with the latest version of our iOS SDK. At this point you can skip down to Step 2. Remove the iOS Status Bar.

    Manual Integration

    Download Vungle SDK v6. If you are updating from a previous version of the Vungle SDK, first remove the VungleSDK.framework directory completely before adding the new SDK.

    Find the extracted files and drag the VungleSDK.framework directory into Xcode under Frameworks. Be sure to add the VungleSDK.framework folder as a group (yellow folder) and not as a reference (blue folder).

    Add Other Required Frameworks

    The Vungle SDK now ships with the build setting Link Frameworks Automatically set to YES, meaning you should no longer be required to link all the previously required frameworks and libraries (see below). With this update, you should only need to optionally link the following frameworks: included:

    CoreFoundation.framework

    Foundation.framework

    StoreKit.framework

    These previously required frameworks and libraries are included here so you can remove them if your project doesnt reference any of them:

    Support.framework

    AudioToolbox.framework

    AVFoundation.framework

    CFNetwork.framework

    CoreGraphics.framework

    CoreMedia.framework

    libz.dylib or libz.tbd

    MediaPlayer.framework

    QuartzCore.framework

    StoreKit.framework

    SystemConfiguration.framework

    Note:Vungle SDK V.6 does not support iOS 7 or lower. If you have iOS 7 as a deploymenttarget, use Vungle iOS SDK v.4.1 or lower, and include these frameworks:

    UIKit.framework

    WebKit.framework

    Foundation.framework

    Make sure that the VungleSDK framework appears under Linked Frameworks and Libraries.

    Add the -ObjC Linker Flag

    Click on your project in Project Navigator and go to Build Settings Linking Other Linker Flags. Add -ObjC to Other Linker Flags.

    Step2.RemovetheiOSStatusBar

    Although this step is not required, we recommend that you remove the iOS status bar to ensure that Vungle's ad interaction and presentation perform smoothly. To remove the status bar, open your Info.plist, add the key View controller-based status bar appearance, and set it to No.

    Step3.AddCode

    Initialize the SDK

    Initialize the SDK as soon as your app starts; if you are using a cache-optimized placement, doing this gives the SDK enough time to cache an ad for that placement. You will need the App ID to initialize the SDK. You can find the App ID in the Vungle Dashboard.

    - (BOOL)startWithAppId:(nonnull NSString *)appID error:(NSError **)error;

    Sample code:

    #import <VungleSDK/VungleSDK.h>

    ...

    NSError* error;

    NSString* appID = @"Your_AppID_Here";

    VungleSDK* sdk = [VungleSDK sharedSDK];if (![sdk startWithAppId:appID error:&error]) { if (error) { NSLog(@"Error encountered starting the VungleSDK: %@", error); }}

    Once the SDK is initialized successfully, the following callback method is called:

    - (void)vungleSDKDidInitialize;

    Refer to the Delegate Callbacks section of this article.

    You can also check the status of the SDK initialization with the following property:

    @property (atomic, readonly, getter=isInitialized) BOOL initialized;

    Since Vungle SDK v.6.4.3, after initialization we will automatically optimize the caching behaviors to maximize your monetization performance.

    Once initialization is successful, watch for the vungleAdPlayabilityUpdate callback method to be called with the placement reference IDs matching your cache-optimized placement. (Refer to the Check Ad Availability for a Placement )

    Load an Ad for a Placement

    To load an ad, you will need to call loadPlacementWithID method:

    -(BOOL)loadPlacementWithID:(NSString *)placementID error:(NSError **)error;

    Sample code:

    NSError* error;

    VungleSDK* sdk = [VungleSDK sharedSDK];

    NSString* placementID = @"Your_placement_ID_Here";VungleSDK* sdk = [VungleSDK sharedSDK];if (![sdk loadPlacementWithID:placementID error:&error]) { if (error) { NSLog(@"Error occurred when loading placement: %@", error); }}

    Check Ad Availability for a Placement

    Once the SDK finishes caching an ad for a placement, the following callback method is called:

    - (void)vungleAdPlayabilityUpdate:(BOOL)isAdPlayable placementID:(nullable NSString *)placementID error:(nullable NSError *)error;

    Sample code:

    - (void)vungleAdPlayabilityUpdate:(BOOL)isAdPlayable placementID:(NSString *)placementID error:(nullable NSError *)error {

    if([placementID isEqualToString:@"Your_placement_ID_Here"]) {

    self.playButtonPlacement1.enabled = isAdPlayable;

    }

    }

    Note: For the cache-optimized placements, only when an ad becomes available is this callback method called. The SDK will keep requesting an ad for these placements. For all other placements, this callback method is called in case of Load Failed (isAdPlayable returns NO in this case).

    You can also check the ad availability for a placement with the following property:

    - (BOOL)isAdCachedForPlacementID:(nonnull NSString *)placementID;

    Play an Ad

    After you make sure that an ad is ready for a placement, you can play the ad with the following method:

    - (BOOL)playAd:(UIViewController *)controller options:(nullable NSDictionary *)options placementID:(nullable NSString *)placementID error:( NSError *__autoreleasing _Nullable *_Nullable)error;

    Sample Code:

    VungleSDK* sdk = [VungleSDK sharedSDK];

    NSError *error;

    [self.sdk playAd:self options:nil placementID:@"" error:&error];

    if (error) {

    NSLog(@"Error encountered playing ad: %@", error);

    }

    In-Feed Ads

    Since Vungle SDK v.5.3, we support In-Feed ads. This is the first ad format that does not require a full screen; instead, the publisher determines the exact dimensions and location of the ad container within their app. These ad containers can be in collection views or table views.

    Loading an In-Feed Ad

    Loading an In-Feed ad is the same as loading a fullscreen ad; however, the placement must be configured to support In-Feed. Contact your Vungle account manager to enable In-Feed for a placement.

    Displaying an In-Feed Ad

    Displaying an In Feed ads differs from displaying fullscreen ads. With In-Feed ads, you must first create a container for the ad. This container is a UIView. You can place said UIView anywhere on the screen. The ad will scale to any size of container, but keep in mind that very low resolution will make ads less visible. You must then call the addAdViewToView function to associate the container with the In-Feed ad.

    Note: If the UIView created for the In-Feed ad is created in Interface Builder, you should create a local UIView instance (of the same width and height as the IB view) and add that as a subview to the Interface Builder view. This will allow you to add and remove the In-Feed view and reuse the In-Feed UIView container as needed.

    Function overview:

    /**

    * Pass in an UIView which acts as a container for the ad experience. This view container may be placed in random positions.

    * @param publisherView container view in which an ad will be displayed

    * @param options A reference to an instance of NSDictionary with customized ad playback options

    * @param placementID The placement defined on the Vungle dashboard

    * @param error An optional double reference to an NSError. In case this method returns `NO` it will be non-nil

    * @return YES/NO in case of success/error while presenting an AdUnit

    */

    - (BOOL)addAdViewToView:(UIView *)publisherView withOptions:(nullable NSDictionary *)options placementID:(nullable NSString *)placementID error:( NSError *__autoreleasing _Nullable *_Nullable)error;

    Sample code:

    NSError *error;NSDictionary *options = @{};VungleSDK* sdk = [VungleSDK sharedSDK];@property (strong, nonatomic) UIView *tempIn-FeedFeedView;// Play a Vungle ad (with default options) if (!self.tempIn-FeedFeedView) { // This view has the same size as the corresponding view created in interface builder self.tempIn-FeedFeedView = [[UIView alloc] initWithFrame:self.In-FeedFeedView.bounds]; } // add temp view as subview to view created in Interface Builder [self.In-FeedFeedView addSubview:self.tempIn-FeedFeedView]; NSError *error; [self.sdk addAdViewToView:self.tempIn-FeedFeedView withOptions:nil placementID:placementID error:&error];if (![sdk addAdViewToView:_In-FeedFeedViewArea withOptions:options placementID:@"Your_placement_ID_Here" error:&error]) { if (error) { NSLog(@"Error encountered while playing an ad: %@", error); }}

    Closing an In-Feed Ad

    Due to the nature of In-Feed ads, a user can stop viewing the video without closing the ad. You must therefore tell the SDK to dismiss the ad when it is no longer on screen. To do this, call the finishedDisplayingAd function. This function only works with MREC and In-Feed ads. Note that this function does not take in a placement; it will simply close any native ad currently playing.Depending on the implementation, you may need to include some cleanup (removing the In-Feed container UIView from its parent view, etc.)

    Function overview:

    /**

    * This method must be called when the publisher is confident that they are finished displaying the ad unit.

    * This signals to the SDK that a new ad may be fetched or a different ad may be displayed. This will

    * be called in conjunction with `addViewToView:containedInViewController:withOptions:placementID:error:`

    */

    - (void)finishedDisplayingAd;

    Sample code:

    //Ad is no longer on screen

    VungleSDK* sdk = [VungleSDK sharedSDK];

    [sdk finishedDisplayingAd];[self.tempIn-FeedFeedView removeFromSuperview];self.tempIn-FeedFeedView = nil;

    Note: Only one In-Feed Ad should be playing at a time. Hence you should make sure you dismiss any In-Feed Ad before attempting to play another ad.

    MREC Ads

    Since Vungle SDK v.6.4.3, we support MREC ads. Similarly to In-Feed ads, this ad format does not require a full screen; instead, the publisher determines the location of the ad container within their app. However, the size of the MREC container has to be 300 250, which is the industry standard.

    Loading an MREC Ad

    Similarly to In-Feed, the placement type for MREC has to have the type MREC in Vungle dashboard.

    Displaying an MREC Ad

    Similarly to In-Feed ads, you must first create a container for the MREC ads. This container is aUIViewhaving the size of 300 250. You can place saidUIView anywhere on the screen. You must then call theaddAdViewToViewfunction to associate the container with the MREC ad.

    Function overview:

    /** * Pass in an UIView which acts as a container for the ad experience. This view container may be placed in random positions. * @param publisherView container view in which an ad will be displayed * @param options A reference to an instance of NSDictionary with customized ad playback options * @param placementID The placement defined on the Vungle dashboard * @param error An optional double reference to an NSError. In case this method returns `NO` it will be non-nil * @return YES/NO in case of success/error while presenting an AdUnit */- (BOOL)addAdViewToView:(UIView *)publisherView withOptions:(nullable NSDictionary *)options placementID:(nullable NSString *)placementID error:( NSError *__autoreleasing _Nullable *_Nullable)error;

    Sample code:

    NSError *error;NSDictionary *options = @{};VungleSDK* sdk = [VungleSDK sharedSDK];if (![sdk addAdViewToView:_mrecViewArea withOptions:options placementID:@"Your_placement_ID_Here" error:&error]) { if (error) { NSLog(@"Error encountered while playing an ad: %@", error); }}

    Closing an MREC Ad

    Similarly to In-Feed ads, to close an MREC ad, call thefinishedDisplayingAd function. This function only works with MREC and In-Feed ads. Note that this function does not take in a placement; it will simply close any native ad currently playing. Depending on the implementation, you may need to include some cleanup (removing the In-Feed container UIView from its parent view, etc).

    Function overview:

    /**

    * This method must be called when the publisher is confident that they are finished displaying the ad unit.

    * This signals to the SDK that a new ad may be fetched or a different ad may be displayed. This will

    * be called in conjunction with `addViewToView:containedInViewController:withOptions:placementID:error:`

    */

    - (void)finishedDisplayingAd;

    Sample code:

    //Ad is no longer on screen

    VungleSDK* sdk = [VungleSDK sharedSDK];

    [sdk finishedDisplayingAd];

    Delegate Callbacks

    You can receive callbacks from the SDK with VungleSDKDelegate. There are four callback methods in the delegate in which you are notified of the SDK events.

    You can attach and detach your delegate with:

    // Attach

    [[VungleSDK sharedSDK] setDelegate:yourDelegateInstance];

    // Detach

    [[VungleSDK sharedSDK] setDelegate:nil];

    Note: Remember to clear the registered delegate when it's no longer needed to avoid memory leaks.

    The following method is called when the SDK is about to play a video ad. This is a great place to pause gameplay, sound effects, animations, etc.

    - (void)vungleWillShowAdForPlacementID:(nullable NSString *)placementID;

    The following method is called when the SDK is about to close an ad. This is a great place to reward your user and resume gameplay, sound effects, animations, etc.

    - (void)vungleWillCloseAdWithViewInfo:(VungleViewInfo *)info placementID:(NSString *)placementID;

    The following method is called when the SDK has closed an ad:

    - (void)vungleDidCloseAdWithViewInfo:(VungleViewInfo *)info placementID:(NSString *)placementID;

    VungleViewInfo includes the following properties for you to check a result of ad play:

    @interface VungleViewInfo : NSObject

    //Represents a BOOL whether or not the video can be considered a completed view.

    @property (nonatomic, readonly) NSNumber *completedView;

    //The time in seconds that the user watched the video.

    @property (nonatomic, readonly) NSNumber *playTime;

    //Represents a BOOL whether or not the user clicked the download button.

    @property (nonatomic, readonly) NSNumber *didDownload;

    @end

    The following method is called when the SDK has changed ad availability status. The isAdPlayable boolean denotes the new playability of a specific placementID.

    - (void)vungleAdPlayabilityUpdate:(BOOL)isAdPlayable placementID:(nullable NSString *)placementID error:(nullable NSError *)error;

    Refer to the Check Ad Availability for a Placement section of this article.

    The following method is called when the SDK is initialized successfully:

    - (void)vungleSDKDidInitialize;

    The following method is called when the SDK fails to initialize. If this happens, youll need to restart the Vungle SDK.

    - (void)vungleSDKFailedToInitializeWithError:(NSError *)error;

    Customization Options

    Use these options to customize the ad experience for playback.

    Note:Rewardedads are in some cases referred to asincentivizedads; both terms always refer to the same kind of ad. In the SDK code and in our Reporting API, we use the term 'incentivized'.

    Option Keys

    Default Value / Type

    Description

    VunglePlayAdOptionKeyOrientations

    autorotate

    UIInterfaceOrientationMaskAll

    An NSNumber representing a bitmask with orientations

    Sets the orientation of the ad. We recommend allowing ads to autorotate, even if your app is in portrait. This way, the user has the option to watch full-size videos, resulting in a better user experience. You can achieve this by setting the orientation on a view controller level (rather than a project level).

    VunglePlayAdOptionKeyUser

    nil

    NSString

    Sets your user ID. The value is passed to Vungle server, and then sent to your server through server-to-server callback system if an placement is set to Rewarded.

    VunglePlayAdOptionKeyIncentivizedAlertTitleText

    nil

    NSString

    String that is used as the title of the alert dialog presented when a user closes a rewarded ad experience prematurely.

    VunglePlayAdOptionKeyIncentivizedAlertBodyText

    Are you sure you want to skip this ad? If you do, you might not get your reward

    NSString

    String that is used as the body text of the alert dialog presented when a user closes a rewarded ad experience prematurely.

    VunglePlayAdOptionKeyIncentivizedAlertCloseButtonText

    Close

    NSString

    String title for the close button text of the alert dialog presented when a user closes a rewarded ad experience prematurely.

    VunglePlayAdOptionKeyIncentivizedAlertContinueButtonText

    Continue

    NSString

    String title for the close button text of the alert dialog presented when a user closes a rewarded ad experience prematurely.

    VunglePlayAdOptionKeyFlexViewAutoDismissSeconds

    Int

    Use this option to make Flex View ads dismiss automatically after the specified number of seconds. This function only works with Flex View ads.

    VunglePlayAdOptionKeyOrdinal

    Int

    If you receive ordinal data reports from Vungle, use this field to pass the mediation ordinal. This is an integerindicating the order in which this ad was shown in the game session (for example, if two ads were already shown in this session, and this ad from Vungle was then shown third, pass in '3'). Read more about ordinal data here.

    Sample Code

    NSDictionary *options = @{VunglePlayAdOptionKeyOrientations: @(UIInterfaceOrientationMaskLandscape),

    VunglePlayAdOptionKeyUser: @"userGameID",

    VunglePlayAdOptionKeyIncentivizedAlertBodyText : @"If the video isn't completed you won't get your reward! Are you sure you want to close early?",

    VunglePlayAdOptionKeyIncentivizedAlertCloseButtonText : @"Close",

    VunglePlayAdOptionKeyIncentivizedAlertContinueButtonText : @"Keep Watching",

    VunglePlayAdOptionKeyIncentivizedAlertTitleText : @"Careful!"};

    // Pass in dict of options, play ad

    NSError *error;

    [self.sdk playAd:self options:options placementID: error:&error];

    if (error) {

    NSLog(@"Error encountered playing ad: %@", error);

    }

    Mute Option

    The Vungle SDK instance offers the option to play ads with the sound disabled. You can set the muted property to true before issuing a playAd().

    Sample code:

    VungleSDK* sdk = [VungleSDK sharedSDK];

    self.sdk.muted = true;

    Note:This option only applies to the standard ad type for SDK version 6.3.1 and below. The muted option for Dynamic Template ads is available to configure on the dashboard. v6.3.2 will respect SDK side mute setting for all ads.

    Memory Settings

    Starting from v6.4.3, you can prevent the SDK from downloading, requesting ads or even initializing if the storage of your iPhone falls below a predefined threshold. If this happens, you will get an error similar to the following:

    Error while starting VungleSDK There is not enough file system size on a device to initialize VungleSDK.

    These are the option keys available:

    Option Keys

    Default Value / Type

    Description

    vungleMinimumFileSystemSizeForInit

    Integer, value in MB, default value is 50

    Sets the required minimum available free storage space to be able to initialize the SDK

    vungleMinimumFileSystemSizeForAdRequest

    Integer, value in MB, default value is 50

    Sets the required minimum available free storage space to be able to request an ad

    Sample code:

    [[NSUserDefaults standardUserDefaults] setInteger:200 forKey:@"vungleMinimumFileSystemSizeForInit"];[[NSUserDefaults standardUserDefaults] setInteger:200 forKey:@"vungleMinimumFileSystemSizeForAdRequest"]; //After setting the desired values above, synchronize[[NSUserDefaults standardUserDefaults] synchronize];

    Restrict usage of IDFV

    Starting from v6.4.3, you cannow restrict from passing the IDFV from the device to the SDK.

    Sample code:

    [VungleSDK setPublishIDFV:NO];if (![sdk startWithAppId:appID error:&error]) {

    if (error) {

    NSLog(@"Error encountered starting the VungleSDK: %@", error);

    }

    }

    GDPR Recommended Implementation Instructions

    As of May 25th 2018, the General Data Protection Regulation (GDPR) will be enforced in the European Union. To comply with GDPR, developers have two options.

    Option 1 (recommended): Publisher controls the GDPR consent process at the user level, then communicates the users choice to Vungle. To do this, developers can collect the users consent using their own mechanism, and then use Vungle APIs to update or query the users consent status. Refer to the GDPR Recommended Implementation Instructions section for details.

    Option 2: Allow Vungle to handle the requirements. Vungle will display a consent dialog before playing an ad for a European user, and will remember the users consent or rejection for subsequent ads.

    To use Vungle APIs to update or query the users consent status (as recommended in Option 1 of Vungle's GDPR: Recommended Implementation ), use these functions for v6.3.2 and above:

    // This function sets the consent status that will be recorded in Vungle SDK. Accepted values: 'VungleConsentAccepted' or 'VungleConsentDenied'. It also sets the consent message version. This value is an arbitrary string, and can be used to identify the version of the consent message presented to the user.

    // To set the user's consent status to opted in:

    [[VungleSDK sharedSDK] updateConsentStatus:VungleConsentAccepted consentMessageVersion:@"Some Consent Message Version"];

    // To set the user's consent status to opted out:

    [[VungleSDK sharedSDK] updateConsentStatus:VungleConsentDenied consentMessageVersion:@"Some Consent Message Version"];

    // To find out what the user's current consent status is:

    // (Check against enum values: 'VungleConsentAccepted' or 'VungleConsentDenied'.)

    [[VungleSDK sharedSDK] getCurrentConsentStatus];

    // To find out which version of the consent message was shown to the user:

    // This method returns an NSString value.

    [[VungleSDK sharedSDK] getConsentMessageVersion];

    VungleConsentStatus is an enum containing two states:

    VungleConsentAccepted

    VungleConsentDenied

    The SDK also has an initial state of 'unknown', which prompts the user to opt in or opt out of user data collection. Note that this prompt only occurs on IP addresses originating from Europe.

    v6.2.0 does not have ability to pass consent message version, so please use following APIs.

    // This function sets the consent status that will be recorded in Vungle SDK. Accepted values: 'VungleConsentAccepted' or 'VungleConsentDenied'.

    // To set the user's consent status to opted in:

    [[VungleSDK sharedSDK] updateConsentStatus:VungleConsentAccepted]

    // To set the user's consent status to opted out:

    [[VungleSDK sharedSDK] updateConsentStatus:VungleConsentDenied];

    // To find out what the user's current consent status is:

    // (Check against enum values: 'VungleConsentAccepted' or 'VungleConsentDenied'.)

    [[VungleSDK sharedSDK] getCurrentConsentStatus];

    Debug

    If you need SDK information, you can get it by using this property:

    - (NSDictionary *)debugInfo;

    If you want the SDK to output logs, use the following method:

    - (void)setLoggingEnabled:(BOOL)enable;

    VungleSDKLogger Protocol

    @protocol VungleSDKLogger

    - (void)vungleSDKLog:(NSString*)message;

    @end

    The VungleSDK singleton sends logging events to any attached class following the VungleSDKLogger protocol. The log event contains the NSString value that is also printed to console (if logging has been enabled). To attach your logger, use the following:

    [sdk attachLogger:yourLoggerInstance];

    As mentioned above, it's important to clear out attached loggers from the Vungle SDK. Loggers can be detached using the following approach:

    [sdk detachLogger:yourLoggerInstance];

    Check Initialization State

    Some of the resources allocated to Vungle SDK can be terminated by OS if system resources are running low or many context switching take place. We recommend checking SDK initialization state before invoking SDK API to ensure smooth operation of SDK.Invoke isInitialized before calling any SDK API and re-initialize SDK if it returns NO.

    if ([self.sdk isInitialized] == NO) {

    [self initVungleSDK];

    }

    View Article
  • Contents

    Before You Begin

    Step 1. Set Up Your Unity Project with the Vungle Unity Plugin

    Step 2. Add Code

    Before You Begin

    Vungle Unity plugin 6.4.4includes iOS SDK 6.4.6, Android SDK 6.4.11 and Windows SDK 6.4.1

    iOS

    Unity 5.4.1 or higher, Unity 2017

    iOS 9 or higher

    The Vungle SDK requires that you link the WebKit.framework framework to your project. If you are developing for IOS 7, you mustset this framework to 'Optional'. To do this, click on your project in Project Navigator and go to General Linked Frameworks and Libraries. Select WebKit.framework and set the Status to Optional.

    Android

    Android 4.0 (Ice Cream Sandwich - API version 14 and above)

    Amazon OS 5.4 and above

    Unity 5.3.2 or higher, Unity 2017

    requires Java 1.7 for Android

    Windows

    Windows 10 UWP and Universal 8.1 supports Unity 5.3.2 or higher,Unity 2017

    Download Vungle Unity plugin at https://publisher.vungle.com/sdk/plugins/unity

    Download our sample app at https://github.com/Vungle/Unity-Plugin

    Unity 2018 and 2019 are not officially supportd yet as of Unity Plugin v6.4.3

    Step 1. Set Up Your Unity Project with the Vungle Unity Plugin

    Add the Vungle Unity Plugin to your Unity Project

    With your project open in Unity, double-click the downloaded VunglePlugin.unitypackage file to add the Vungle Unity Plugin to your application. When the Import Unity Package window opens, click All to select everything before importing.

    Target the Correct Platform in Your Build Settings

    To avoid compilation errors during the next step, make sure that your project Build Settings (cmd + Shift + B) are targeting the iOS or Android platform.

    Amazon Appstore

    Vungle Android SDK supports Amazon OS 5.4 and higher. You can submit Android APK to the Amazon Appstore, with the additional setup of Unity Amazon Appstore configuration. Refer to the Unity instructions at the following link: https://docs.unity3d.com/Manual/UnityIAPAmazonConfiguration.html.

    Google Play Services

    Including Google Play Services with your project allows Vungle to provide a more customized ad experience to the end user, but it's not required. We recommend using version 16.0.0 or higher.

    To include Google Play Services, we recommend Google's setup guide found on the developer portal at http://developer.android.com/google/play-services/setup.html#Setup. In your app, ensure that the device has a sufficiently updated version of Google Play Services.

    Android Dependencies

    Vungle SDK for Android requires one of the following dependency to be included in your build. Please add them manually, or if you use a Gradle template you can include them in it.

    // Either appcompat-v7 or support-v4 is need for SDK operation

    implementation 'com.android.support:appcompat-v7:28.0.0' // Either

    implementation 'com.android.support:support-v4:27.1.1' // Or

    Adding Hardware Acceleration (Android only)

    Hardware acceleration is enabled by default if your target API level is set to 14 or above. This option must be enabled for the SDK to properly show Dynamic Template and Native Flex ads. Please make sure your project does not have this option set to false.

    Sample code:

    <application android:hardwareAccelerated="true" ...>

    Step 2: Add Code

    In this walkthrough we initialize all of our Vungle-related code in a script attached to the main Game Object. You can call the Vungle Unity Plugin from any scripts you think are appropriate.

    Initialize the SDK

    Note: A default placement is created for each app automatically. You must provide its placement reference ID in this initialization step whether or not you plan to take advantage of the placements functionality. If you create multiple placements, provide all the reference IDs.

    Initialize the SDK as soon as your app starts in order to give the SDK enough time to cache an ad. To initialize the SDK, you will need the App IDs for the platforms you wish to support.

    You can find these IDs in the Vungle Dashboard (refer to " Setting Up and Reporting on Placements ").

    Sample code:

    public class VungleScript : MonoBehaviour {

    string appID = ""; string iosAppID = "ios_app_id"; string androidAppID = "android_app_id"; string windowsAppID = "windows_app_id";

    #if UNITY_IPHONE

    appID = iosAppID;

    #elif UNITY_ANDROID

    appID = androidAppID;

    #elif UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO

    appID = windowsAppID;

    #endif

    Vungle.init(appID);}

    Once the SDK is initialized successfully, it calls the following event:

    public static event Action onInitializeEvent;

    Refer to the Event Handling section of this article.

    Please reach out to your account manager about cache optimized placements to maximize caching performance.

    Once an ad is cached successfully, the adPlayableEvent event is called with the placement reference ID matching your placement. (Refer to the Check Ad Availability for a Placement section of this article.)

    Load an Ad for a Placement

    For all placements call theloadAd method to load an ad.

    public static void loadAd(string placementID)

    Make sure that you are using the placementID that is linked to the correct platform.

    Sample code:

    string placementID;

    #if UNITY_IPHONE

    placementID = "ios_placement_id";

    #elif UNITY_ANDROID

    placementID = "android_placement_id";

    #elif UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_METRO

    placementID = "windows_placement_id";

    #endif

    Vungle.loadAd(placementID);

    Check Ad Availability for a Placement

    Once the SDK finishes caching an ad for a placement, the following event is called:

    public static event Action<string, bool> adPlayableEvent;

    Sample code:

    Vungle.adPlayableEvent += (placementID, adPlayable) => {

    if(placementID == "ios_placement_id") {

    playButtonPlacement1.enabled = adPlayable;

    }

    };

    Note:For the cache optimized placements, this event is called only when an ad becomes available. Optimized placements will automatically attempt to fill without further action. For all other placements, this event is also called in case of Load Failed (adPlayable returns false in this case).

    You can also check the ad availability for a placement with the following method:

    public static bool isAdvertAvailable(string placementID);

    Play an Ad

    Important: Do not play an ad untilthe adPlayableEvent function described above returns 'true'. If you try to play an ad before theadPlayableEvent function returns 'true', the user experience will be adversely affected while the ad tries to load. If deploying to Android, instead use the value returned from isAdvertAvailable() to ensure an ad is available (as adPlayableEvent will not return false when no ad is available).

    When there is an ad available for a placement, you can play the ad with the following method:

    public static void playAd(string placementID);

    Sample code:

    Vungle.playAd (placementID);

    Event Handling

    You can set up event handlers for all 5 Vungle SDK events surrounding ad presentation.

    The following event is fired when the SDK starts to play a video ad. This is a great place to pause gameplay, sound effects, animations, etc.

    public static event Action onAdStartedEvent;

    The following event is fired when the SDK closes an ad. This is a great place to reward your users and resume gameplay, sound effects, animations, etc.

    public static event Action<string, AdFinishedEventArgs> onAdFinishedEvent;

    The AdFinishedEventArgs class consists of the following properties for you to check the result of an ad play:

    public class AdFinishedEventArgs : EventArgs

    {

    //Represents a BOOL whether or not the user clicked the download button.

    public bool WasCallToActionClicked{ get; set;}

    //Represents a bool whether or not the video can be considered a completed view.

    public bool IsCompletedView{ get; set;}

    }

    The following event is fired when the SDK has changed ad availability status. The isAdPlayable boolean denotes the new playability of a specific placementID.

    public static event Action<string, bool> adPlayableEvent;

    Refer to the Check Ad Availability for a Placement section of this article for more details.

    The following event is fired when the SDK is initialized successfully.

    public static event Action onInitializeEvent;

    Sample code:

    void initializeEventHandlers() {

    Vungle.onAdStartedEvent += (placementID) => {

    DebugLog ("Ad " + placementID + " is starting! Pause your game animation or sound here.");

    };

    Vungle.onAdFinishedEvent += (placementID, args) => {

    DebugLog ("Ad finished - placementID " + placementID + ", was call to action clicked:" + args.WasCallToActionClicked + ", is completed view:"

    + args.IsCompletedView);

    };

    Vungle.adPlayableEvent += (placementID, adPlayable) => {

    DebugLog ("Ad's playable state has been changed! placementID " + placementID + ". Now: " + adPlayable);

    };

    Vungle.onInitializeEvent += () => {

    adInited = true;

    DebugLog ("SDK initialized");

    };

    }

    OnPause and OnResume Functionality

    Add code for the onPause and onResume functionality that enables ads that were paused when an app was backgrounded to resume playing.

    void OnApplicationPause(bool pauseStatus) {

    if (pauseStatus) {

    Vungle.onPause();

    }

    else {

    Vungle.onResume();

    }

    }

    Customization Options

    The playAd method can also accept an options dictionary to customize the ad playing experience.

    public static void playAd(Dictionary<string,object> options, string placementID);

    Note:Rewardedads are in some cases referred to asincentivizedads; both terms always refer to the same kind of ad. In the SDK code and in our Reporting API, we use the term 'incentivized'.

    The options dictionary accepts the following keys:

    Key

    Description

    orientation

    Sets the orientation of the ad.

    For iOS, use VungleAdOrientation:

    public enum VungleAdOrientation

    {

    Portrait = 1,

    LandscapeLeft = 2,

    LandscapeRight = 3,

    PortraitUpsideDown = 4,

    Landscape = 5,

    All = 6,

    AllButUpsideDown = 7

    }

    For Android, set to true for matchVideo and false for autoRotate.

    userTag

    String of the user key that is passed to identify users in the S2S call (if there are any).

    alertTitle

    String that is used as the title of the alert dialog presented when a user closes an incentivized ad experience prematurely.

    alertText

    String that is used as the body text of the alert dialog presented when a user closes an incentivized ad experience prematurely.

    closeText

    String title for the close button text of the alert dialog presented when a user closes an incentivized ad experience prematurely.

    continueText

    String title for the close button text of the alert dialog presented when a user closes an incentivized ad experience prematurely.

    immersive

    Boolean which sets Immersive Mode (forces hiding the navigation bar and status bar). (Android only)

    flexCloseSec

    Integer determining the number of seconds after which the Flex View ad can auto-dismiss. This setting only affects Flex View ads. (iOS only)

    Minimum disk space

    Minimum disk space configuration was introduced in version 6.4.0 to determine the limits for available space on a users device before the Vungle SDK initializes and fetch ads. Default value for SetMinimumDiskSpaceForInitialization is 51 MB and SetMinimumDiskSpaceForAd is 50 MB. The size is entered in bytes (not MB).

    Vungle.SetMinimumDiskSpaceForInitialization(minValue); Vungle.SetMinimumDiskSpaceForAd(minValue);

    Vungle.init(appID);

    Disable Hardware ID

    For SDK version 6.4.0 onwards, publishers can now restrict from passing Hardware ID from the device to the SDK.

    //Set false to opt in for Hardware ID collection by SDK or true to opt outVungle.EnableHardwareIdPrivacy(m_disableHardwareID);

    GDPR: Recommended Implementation

    As of May 25th, the General Data Protection Regulation (GDPR) will be enforced in the European Union. To comply with GDPR, developers have two options.

    Option 1 (recommended): Publisher controls the GDPR consent process at the user level, then communicates the users choice to Vungle. To do this, developers can collect the users consent using their own mechanism, and then use Vungle APIs to update or query the users consent status. Refer to the " GDPR Recommended Implementation Instructions " section for details.

    Option 2: Allow Vungle to handle the requirements. Vungle will display a consent dialog before playing an ad for a European user, and will remember the users consent or rejection for subsequent ads.

    GDPR Recommended Implementation Instructions

    To use Vungle APIs to update or query the users consent status as recommended in Option 1, use the Vungle.Consent enumerator and set the current value with the below two functions.

    // The Consent enum is used to represent the user's current GDPR opt-in status

    public enum Consent {

    Undefined = 0,

    Accepted = 1,

    Denied = 2

    }

    // Sets the user's consent status

    void updateConsentStatus(Vungle.Consent consent);

    // Sets the user's consent status and also sets a string to track GDPR version

    void updateConsentStatus(Vungle.Consent consent, string consentMessageVersion);

    // Gets the user's consent status Vungle.Consent getConsentStatus();

    Flex View Ads

    For iOS

    To programmatically close a Flex View ad, use the closeAd function:

    Vungle.closeAd(placementID);

    This function does not work on Android.

    For Android

    Flex View does not work the same on Unity Android as it does on Unity iOS or native Android. Because of a limitation in how Unity handles activities, Flex View does not allow a user to interact with the base game while a Flex View ad displays. In a Flex View ad, the underlying activity is suspended while an activity occurs on top. If a user leaves an app while a Flex View ad is visible and then returns to the app at a later date, the ad will still be displayed, but the background game will show up as black. This happens because the base activity is suspended until the Flex View ad is dismissed.

    For this reason, avoid Flex View ads on Unity Android.

    For Windows

    Flex View ads are unsupported on Windows.

    In-Feed Ads

    In-Feed ads are unsupported when integrating Vungle through the Unity plugin.

    View Article
  • GDPR: Recommended Implementation

    As of May 25th, the General Data Protection Regulation (GDPR) will be enforced in the European Union. To comply with GDPR, developers have two options.

    Option 1 (recommended): Publisher controls the GDPR consent process at the user level, then communicates the users choice to Vungle. To do this, developers can collect the users consent using their own mechanism, and then use Vungle APIs to update or query the users consent status. Refer to the GDPR Recommended Implementation Instructions section for details.

    Option 2: Allow Vungle to handle the requirements. Vungle will display a consent dialog before playing an ad for a European user, and will remember the users consent or rejection for subsequent ads.

    Before YouGet Started

    The Vungle iOS SDK v.6.4.6 supports Xcode 11 or higher.

    Vungle iOS SDK v.6.4.6 supports applications that run on iOS 9 and higher. We do not recommend integrating the SDK in iOS versions lower than 9.0.

    The Vungle iOS SDK v.6.4.6 has been tested with the latest iOS 13.

    The Vungle iOS SDK v.6.4.6 supports 64-bit apps.

    Integration requires you to have a Vungle account. If you don't yet have an account, create one before proceeding.

    We recommend using Xcode 11 to archive the app, as Xcode 10 will result in "Invalid Bitcode version error".

    The source code referenced here is available on our public GitHub repo.

    Step 1. Add the Vungle Framework to your Xcode Project

    Add the VungleSDK.framework to your Project

    There are two ways to add Vungle to your Xcode project: using Cocoapods or manual integration.

    Cocoapods

    The Vungle SDK is available through Cocoapods. Add Vungle to your project by adding the following line into your projects podfile.

    pod "VungleSDK-iOS", "6.4.6"

    After that, a quick pod install run should update your project with the latest version of our iOS SDK. At this point you can skip down to Step 2. Remove the iOS Status Bar.

    Manual Integration

    Download Vungle SDK v6.4.6. If you are updating from a previous version of the Vungle SDK, first remove the VungleSDK.framework directory completely before adding the new SDK. Then findthe extracted files and drag the VungleSDK.framework directory into Xcode under Frameworks. Be sure to add the VungleSDK.framework folder as a group (yellow folder) and not as a reference (blue folder).

    Add Other Required Frameworks

    The Vungle SDK now ships with the build settingLink Frameworks Automaticallyset toYES, meaning you should no longer be required to link all the previously required frameworks and libraries (see below). With this update, you should only need tooptionallylink the following frameworks: included:

    CoreFoundation.framework

    Foundation.framework

    StoreKit.framework

    These previously required frameworks and libraries are included here so you can remove them if your project doesnt reference any of them:

    Support.framework

    AudioToolbox.framework

    AVFoundation.framework

    CFNetwork.framework

    CoreGraphics.framework

    CoreMedia.framework

    libz.dylib or libz.tbd

    MediaPlayer.framework

    QuartzCore.framework

    StoreKit.framework

    SystemConfiguration.framework

    Note:Vungle SDK v.6 does not support iOS 7. If you have iOS 7 as a deploymenttarget, use Vungle iOS SDK v.4.1 or lower, and include these frameworks:

    UIKit.framework

    WebKit.framework

    Foundation.framework

    Make sure that the VungleSDK framework appears underLinked Frameworks and Libraries.

    Add the -ObjC Linker Flag

    Click on your project in Project Navigator and go to Build Settings Linking Other Linker Flags. Add -ObjC to Other Linker Flags.

    Step2.RemovetheiOSStatusBar

    Although this step is not required, we recommend that you remove the iOS status bar to ensure that Vungle's ad interaction and presentation perform smoothly. To remove the status bar, open your Info.plist, add the key View controller-based status bar appearance, and set it to No.

    Step3.AddCode

    Create a Bridging Header File

    Create a new Objective-C file in your project (File New File [Objective-C File]).

    Xcode will ask if you'd like to create a bridging header file between Objective-C and Swift. Accept this prompt.

    Delete the new Objective-C file (${YOURPROJ}-Bridging-Header.m), but retain the bridging header file ${YOURPROJ}-Bridging-Header.h.

    In the Bridging header file, import the Vungle SDK by adding the following:

    #import <VungleSDK/VungleSDK.h>

    Initialize the SDK

    Initialize the SDK as soon as your app starts; if you are using a cache-optimized placement, doing this gives the SDK enough time to cache an ad for that placement. You will need the App ID to initialize the SDK. You can find the App ID in the Vungle Dashboard.

    - (BOOL)startWithAppId:(nonnull NSString *)appID error:(NSError **)error;

    let appID = "Your_AppID_Here";var placementIDsArray:Array<String> = ["<Your_PlacementID_1>", "<Your_PlacementID_2>", "<Your_PlacementID_3>"];var sdk:VungleSDK = VungleSDK.shared() do { try sdk?.start(withAppId: kVungleTestAppID); } catch let error as NSError { print("Error while starting VungleSDK : \(error.domain)") return; }

    Once the SDK is initialized successfully, the following callback method is called:

    - (void)vungleSDKDidInitialize;

    Refer to the Delegate Callbacks section of this article.

    You can also check the status of the SDK initialization with the following property:

    @property (atomic, readonly, getter=isInitialized) BOOL initialized;

    With the latest SDK v6.4.6, after initialization we will automatically optimize the caching behaviors to maximize your monetization performance.

    Once initialization is successful,watch for thevungleAdPlayabilityUpdatecallback method to be called with the placement reference IDs matching your cache-optimized placement.(Refer to the Check Ad Availability for a Placement section of this article.)

    Load an Ad for a Placement

    To load an ad, you will need to callloadPlacementWithIDmethod:

    var sdk:VungleSDK = VungleSDK.shared()do {try sdk?.loadPlacement(withID: <Your_PlacementID>)}catch let error as NSError {print("Unable to load placement with reference ID :\(<Your_PlacementID>), Error: \(error)") return}

    Refer to the Check Ad Availability for a Placement section of this article.

    Check Ad Availability for a Placement

    Once the SDK finishes caching an ad for a placement, the following callback method is called:

    - (void)vungleAdPlayabilityUpdate:(BOOL)isAdPlayable placementID:(nullable NSString *)placementID;

    Sample code:

    func vungleAdPlayabilityUpdate(_ isAdPlayable: Bool, placementID: String?) { if (placementID == <Your_PlacementID>) { self.playButtonPlacement1.enabled = isAdPlayable; } }

    Note: For the auto-cached placement, only when an ad becomes available is this callback method called. The SDK will keep requesting an ad for the auto-cached placement. For all other placements, this callback method is called in case of Load Failed (isAdPlayable returns NO in this case). You can also check the ad availability for a placement with the following property:

    - (BOOL)isAdCachedForPlacementID:(nonnull NSString *)placementID;

    Play an Ad

    After you make sure that an ad is ready for a placement, you can play the ad with the following method:

    - (BOOL)playAd:(UIViewController *)controller options:(nullable NSDictionary *)options placementID:(nullable NSString *)placementID error:( NSError *__autoreleasing _Nullable *_Nullable)error;

    Sample Code:

    var sdk:VungleSDK = VungleSDK.shared()do {try sdk.playAd(self, options: nil, placementID: kVungleTestPlacementID01)}catch let error as NSError { print("Error encountered playing ad: + \(error)");}

    Delegate Callbacks

    You can receive callbacks from the SDK with VungleSDKDelegate. There are four callback methods in the delegate in which you are notified of the SDK events.

    You can attach and detach your delegate with:

    var sdk:VungleSDK = VungleSDK.shared()// Attachsdk.delegate = <yourDelegateInstance> as VungleSDKDelegate// Detachsdk.delegate = nil

    Note: Remember to clear the registered delegate when it's no longer needed to avoid memory leaks.

    The following method is called when the SDK is about to play a video ad. This is a great place to pause gameplay, sound effects, animations, etc.

    - (void)vungleWillShowAdForPlacementID:(nullable NSString *)placementID;

    The following method is called when the SDK is about to close an ad. This is a great place to reward your user and resume gameplay, sound effects, animations, etc.

    - (void)vungleWillCloseAdWithViewInfo:(VungleViewInfo *)info placementID:(NSString *)placementID;

    The following method is called when the SDK has closed an ad:

    - func vungleDidCloseAd(with info: VungleViewInfo, placementID: String);

    VungleViewInfo includes the following properties to check as theresult of ad play:

    @interface VungleViewInfo : NSObject

    //Represents a BOOL whether or not the video can be considered a completed view.

    @property (nonatomic, readonly) NSNumber *completedView;

    //The time in seconds that the user watched the video.

    @property (nonatomic, readonly) NSNumber *playTime;

    //Represents a BOOL whether or not the user clicked the download button.

    @property (nonatomic, readonly) NSNumber *didDownload;

    @end

    The following method is called when the SDK has changed ad availability status. The isAdPlayable boolean denotes the new playability of a specific placementID.

    - (void)vungleAdPlayabilityUpdate:(BOOL)isAdPlayable placementID:(NSString *)placementID;

    Refer to the Check Ad Availability for a Placement section of this article.

    The following method is called when the SDK is initialized successfully:

    - (void)vungleSDKDidInitialize;

    Customization Options

    Use these options to customize the ad experience for playback.

    Note:Rewardedads are in some cases referred to asincentivizedads; both terms always refer to the same kind of ad. In the SDK code and in our Reporting API, we use the term 'incentivized'.

    Option Keys

    Default Value / Type

    Description

    VunglePlayAdOptionKeyOrientations

    autorotate

    UIInterfaceOrientationMaskAll

    An NSStringrepresenting a bitmask with orientations

    Sets the orientation of the ad. We recommend allowing ads to autorotate, even if your app is in portrait. This way, the user has the option to watch full-size videos, resulting in a better user experience. You can achieve this by setting the orientation on a view controller level (rather than a project level).

    VunglePlayAdOptionKeyUser

    nil

    NSString

    Sets your user ID. The value is passed to Vungle server, and then sent to your server through server-to-server callback system if an placement is set to Rewarded.

    VunglePlayAdOptionKeyIncentivizedAlertTitleText

    nil

    NSString

    String that is used as the title of the alert dialog presented when a user closes an incentivized ad experience prematurely.

    VunglePlayAdOptionKeyIncentivizedAlertBodyText

    Are you sure you want to skip this ad? If you do, you might not get your reward

    NSString

    String that is used as the body text of the alert dialog presented when a user closes an incentivized ad experience prematurely.

    VunglePlayAdOptionKeyIncentivizedAlertCloseButtonText

    Close

    NSString

    String title for the close button text of the alert dialog presented when a user closes an incentivized ad experience prematurely.

    VunglePlayAdOptionKeyIncentivizedAlertContinueButtonText

    Continue

    NSString

    String title for the close button text of the alert dialog presented when a user closes an incentivized ad experience prematurely.

    Sample code:

    let options: NSDictionary = NSDictionary(dictionary: [VunglePlayAdOptionKeyUser: "test_user_id", VunglePlayAdOptionKeyIncentivizedAlertBodyText: "If the video isn't completed you won't get your reward! Are you sure you want to close early?", VunglePlayAdOptionKeyIncentivizedAlertCloseButtonText: "Close", VunglePlayAdOptionKeyIncentivizedAlertContinueButtonText: "Keep Watching", VunglePlayAdOptionKeyIncentivizedAlertTitleText: "Careful!"])do {try self.sdk.playAd(self, options: (options as! [AnyHashable : Any]), placementID: PlacementID)}catch let error as NSError {print("Error encountered playing ad: + \(error)");}

    Mute Option

    The Vungle SDK instance offers the option to play ads with the sound disabled. You can set the muted property to true before issuing a playAd().

    Sample code:

    var sdk:VungleSDK = VungleSDK.shared()sdk.muted = true

    Note: This option only applies to the standard ad type. The muted option for Dynamic Template ads is available to configure on the dashboard.

    Debug

    If you need SDK information, you can get it by using this property:

    - (NSDictionary *)debugInfo;

    If you want the SDK to output logs, use the following method:

    - (void)setLoggingEnabled:(BOOL)enable;

    VungleSDKLogger Protocol

    @protocol VungleSDKLogger

    - (void)vungleSDKLog:(NSString*)message;

    @end

    The VungleSDK singleton sends logging events to any attached class following the VungleSDKLogger protocol. The log event contains the NSString value that is also printed to console (if logging has been enabled). To attach your logger, use the following:

    - (void)attachLogger:(id<VungleSDKLogger>)logger;

    As mentioned above, it's important to clear out attached loggers from the Vungle SDK. Loggers can be detached using the following approach:

    - (void)detachLogger:(id<VungleSDKLogger>)logger;

    GDPR Recommended Implementation Instructions

    To use Vungle APIs to update or query the users consent status (as recommended in Option 1 of Vungle's GDPR: Recommended Implementation ), use these functions:

    //This function returns the current consent status recorded in SDK. If status is not known return 0.

    sdk = VungleSDK.shared()

    sdk?.getCurrentConsentStatus()

    //This function sets the current consent status recorded in the SDK

    sdk = VungleSDK.shared()

    sdk?.update(status: VungleConsentStatus)

    VungleConsentStatus is an enum containing two states:

    accepted (VungleConsentStatus.accepted)

    denied (VungleConsentStatus.denied)

    View Article
  • Before You Begin

    Requirements

    Android 4.0 (Ice Cream Sandwich - API version 14 and above)

    Amazon OS 5.4 and above

    In-Feed and MREC ads requires API version 16 and above

    AndroidX Compatibility

    Vungle Android SDK 6.4.11 or earlier versions do not officially support AndroidX. Publishers must use migration tool that is available from Android Studio to transform the SDK and its dependencies (third-party libraries) for AndroidX compatibility. The official support for AndroidX will be available with 6.5.0 which is currently in early access stage, and that version would not need any further transformation to be AndroidX compatible. Please reach out through your Account Manager for early access to 6.5.0 if you needed.

    Java Doc

    https://vungle.github.io/vungle-android-sdk/javadoc/index.html

    Sample App

    https://github.com/Vungle/Android-SDK/tree/master

    Step 1. Include the Vungle SDK in Your Project

    The Vungle SDK is available in two ways: as an AAR via Maven, or JAR integration.

    Option 1. Gradle Integration

    Open the project-level build.gradle, and ensure that the JCenter details are as below.

    allprojects {

    repositories {

    jcenter()

    }

    }

    Open the app-level build.gradle file for your app, and add compile dependencies in the dependencies section.

    buildscript {

    repositories {

    jcenter()

    }

    }

    dependencies {

    // Vungle SDK

    implementation 'com.vungle:publisher-sdk-android:6.4.11'

    // Either appcompat-v7 or support-v4 is need for SDK operation

    implementation 'com.android.support:appcompat-v7:28.0.0' // Either

    implementation 'com.android.support:support-v4:27.1.1' // Or

    // Recommended for SDK to be able to get Android Advertising ID

    implementation 'com.google.android.gms:play-services-basement:16.0.0'

    implementation 'com.google.android.gms:play-services-ads-identifier:16.0.0'

    }

    If you include the Vungle SDK via Maven, you can skip to " Step 2. Import the Vungle SDK."

    Option 2. JAR/AAR Integration

    Download Vungle SDK v. 6, unzip it, go to the libs folder, copy all the jars and add them to your project libs folder. Note : This zip file contains SDK as a .jar as well as an .aar. Use only one of these depending on jar/aar integration. In case if you are using remote JCenter gradle integration, this zip file and its contents are not needed.

    Open the project-level build.gradle, and update the repositories section:

    allprojects { repositories { jcenter() }}

    Open the app-level build.gradle file for your app, and add other dependencies in the dependencies section. If you are using .aar instead of .jar, you do not need to includeVNG-moat-mobile-app-kit-2.5.1.jarsince .aar is already packaged with this library.

    dependencies {

    // Vungle SDK

    implementation files('libs/vungle-android-sdk-6.4.11.jar')

    // Required Third-party Dependencies

    implementation files('libs/converter-gson-2.5.0.jar')

    implementation files('libs/gson-2.8.2.jar')

    implementation files('libs/logging-interceptor-3.12.0.jar')

    implementation files('libs/okhttp-3.12.0.jar')

    implementation files('libs/okio-1.15.0.jar')

    implementation files('libs/retrofit-2.5.0.jar')

    implementation files('libs/VNG-moat-mobile-app-kit-2.5.1.jar') // Exclude when using AAR

    // Either appcompat-v7 or support-v4 is need for SDK operation

    implementation 'com.android.support:appcompat-v7:28.0.0' // Either

    implementation 'com.android.support:support-v4:27.1.1' // Or

    // Recommended for SDK to be able to get Android Advertising ID

    implementation 'com.google.android.gms:play-services-basement:16.0.0'

    implementation 'com.google.android.gms:play-services-ads-identifier:16.0.0'

    }

    Update AndroidManifest.xml by adding the following lines to your AndroidManifest.xml and assigning the application item name to your application class name for multidex:

    <!--Required Permissions-->

    <uses-permission android:name="android.permission.INTERNET" />

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <!--Recommended Permissions-->

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18" />

    <!--Vungle Activities-->

    <activity

    android:name="com.vungle.warren.ui.VungleActivity"

    android:configChanges="keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"

    android:launchMode="singleTop"

    android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />

    <activity

    android:name="com.vungle.warren.ui.VungleFlexViewActivity"

    android:configChanges="keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"

    android:launchMode="singleTop"

    android:hardwareAccelerated="true"

    android:theme="@android:style/Theme.Translucent.NoTitleBar" />

    <activity

    android:name="com.vungle.warren.ui.VungleWebViewActivity"

    android:configChanges="keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"

    android:launchMode="singleTop" />

    <receiver

    android:name="com.vungle.warren.NetworkProviderReceiver"

    android:enabled="false">

    <intent-filter>

    <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />

    <category android:name="android.intent.category.DEFAULT" />

    </intent-filter>

    </receiver>

    Step 2. Import the Vungle SDK

    import com.vungle.warren.Vungle;

    import com.vungle.warren.AdConfig; // Custom ad configurations

    import com.vungle.warren.InitCallback; // Initialization callback

    import com.vungle.warren.LoadAdCallback; // Load ad callback

    import com.vungle.warren.PlayAdCallback; // Play ad callback

    import com.vungle.warren.VungleNativeAd; // In-Feed and MREC ad

    import com.vungle.warren.Vungle.Consent; // GDPR consent

    import com.vungle.warren.VungleSettings; // Minimum disk space

    import com.vungle.warren.error.VungleException;//onErrormessage

    Step 3. Initialize the Vungle SDK

    Starting with v6.3.12, we have removed the requirement for passing all placement reference ID to be used in the session during the initialization.SDK initialization can now be done without passing Collection of placement reference ID and all active placements for the application ID will be usable to play and load ad. You can still use the legacy API, but it is planned to bedeprecated in the future.

    // New v6 API

    public static void init(@NonNull String appId,

    @NonNull Context context,

    @NonNull InitCallback callback)

    // New v6.4.11 API with optional minimum disk space configuration

    public static void init(@NonNull final String appId,

    @NonNull final Context context,

    @NonNull final InitCallback callback,

    @NonNull final VungleSettings settings)

    // Legacy v6 API

    @Deprecated

    public static void init(@NonNull final Collection placements,

    @NonNull String appId,

    @NonNull Context context,

    @NonNull InitCallback callback)

    The initialization method takes the following parameters:

    Vungle Application ID

    Application context

    InitCallback

    onSuccess: notifies when SDK has successfully initialized

    onError: notifies when the initialization has failed

    throws IllegalArgumentException if InitCallback is null

    throws VungleException if required arguments are missing or invalid

    onAutoCacheAdAvailable: notifies when the auto-cached placement has an ad available to play

    VungleSettings (optional)

    Specify minimum space available on device for SDK initialization and operation

    For all placements, loadAd must be explicitly issued as described in Step 5. Load an Ad.

    Vungle.init(appId, getApplicationContext(), new InitCallback() {

    @Override

    public void onSuccess() {

    // Initialization has succeeded and SDK is ready to load an ad or play one if there

    // is one pre-cached already

    }

    @Override

    public void onError(Throwable throwable) {

    // Initialization error occurred - throwable.getLocalizedMessage() contains error message

    }

    @Override

    public void onAutoCacheAdAvailable(String placementId) {

    // Callback to notify when an ad becomes available for the cache optimized placement

    // NOTE: This callback works only for the cache optimized placement. Otherwise, please use

    // LoadAdCallback with loadAd API for loading placements.

    }

    };

    You can check whether Vungle SDK is initialized anytime by calling the isInitialized method:

    public static boolean isInitialized()

    Step 4. Event Listener

    Implement LoadAdCallback for ad load events and PlayAdCallback for ad play events now if you want to use generic callback for all events. Otherwise, skip to Step 5. Load an Ad to implement inline callbacks.

    // Implement LoadAdCallbackprivate final LoadAdCallback vungleLoadAdCallback = new LoadAdCallback() { @Override public void onAdLoad(String placementReferenceId) { // Placement reference ID for the placement to load ad assets } @Override public void onError(String placementReferenceId, Throwable throwable) { // Placement reference ID for the placement that failed to download ad assets // Throwable contains error message }};

    // Implement PlayAdCallbackprivate final PlayAdCallback vunglePlayAdCallback = new PlayAdCallback() { @Override public void onAdStart(String placementReferenceId) { // Placement reference ID for the placement to be played } @Override public void onAdEnd (String placementReferenceId, boolean completed, boolean isCTAClicked) { // Placement reference ID for the placement that has completed ad experience // completed has value of true or false to notify whether video was // watched for 80% or more // isCTAClkcked has value of true or false to indicate whether download button // of an ad has been clicked by the user } @Override public void onError(String placementReferenceId, Throwable throwable) { // Placement reference ID for the placement that failed to play an ad // Throwable contains error message }};

    Step 5. Load an Ad

    The LoadAdCallback will be notified about the load state for the call to which it was assigned. The SDK only references this callback and does not store it anywhere; it is the responsibility of the caller to ensure that the callback is managed properly.

    public static void loadAd(@NonNull final String id, @Nullable LoadAdCallback callback)

    // Load Ad Implementationif (Vungle.isInitialized()) { Vungle.loadAd("PLACEMENT_ID", new LoadAdCallback() { @Override public void onAdLoad(String placementReferenceId) { } @Override public void onError(String placementReferenceId, Throwable throwable) { // Load ad error occurred - throwable.getLocalizedMessage() contains error message } };}

    Step 6. Check Ad Availability

    Use static method canPlayAdmethod to check if there is an ad available to play for the placement before invoking the playAdmethod

    public static boolean canPlayAd(@NonNull String id)

    Step 7. Play an Ad

    To play an ad, invoke theplayAdmethod, with the placement reference ID, optional AdConfig (null if not being used), and a PlayAdCallback event listener, which will be notified of success or errors during ad playback.

    public static void playAd(@NonNull final String id, final AdConfig settings, @Nullable final PlayAdCallback listener)

    You should always check ad availability by calling the canPlayAd method before invoking the playAd method. You must also make sure that an additional playAd is not issued before your receive an onAdEnd or an onError callback from the initial playAd call, because the ad will not render properly if playAd is repeatedly called in quick succession.

    if (Vungle.canPlayAd("PLACEMENT_ID")) { Vungle.playAd("PLACEMENT_ID", null, new PlayAdCallback() { @Override public void onAdStart(String placementReferenceId) { } @Override public void onAdEnd(String placementReferenceId, boolean completed, boolean isCTAClicked) { } @Override public void onError(String placementReferenceId, Throwable throwable) { // Play ad error occurred - throwable.getLocalizedMessage() contains error message } });}

    Re-initialize SDK when onErroroccurs

    On rare occurrences, resources can become limited, causing the system to deallocate either part of the Vungle SDK, or some of the third-party dependencies our SDK requires. In such cases, LoadAdCallbackand PlayAdCallback fire an onErrorcallback with a Throwable object with a code of VungleException.VUNGLE_NOT_INTIALIZED. This indicates that the Vungle SDK is an inoperable state and must be re-initialized.

    @Override

    public void onError(String placementReferenceID, Throwable throwable) {

    try {

    VungleException ex = (VungleException) throwable;

    if (ex.getExceptionCode() == VungleException.VUNGLE_NOT_INTIALIZED) {

    initializeVungleSDK();

    }

    } catch (ClassCastException cex) {

    Log.d(LOG_TAG, cex.getMessage());

    }

    }

    Native Ads

    In-Feed Ads

    The In-Feed ad format does not require a full screen to display; instead, the Publisher determines the exact dimensions and location of the ad container within their app. These ad containers can be in collection views or table/list views.

    Loading an In-Feed Ads

    The Publisher must load an ad for the In-Feed container. Loading a In-Feed ad is same as loading a full-screen or interstitial ad; however, the placement must be configured to support In-Feed.

    Displaying an In-Feed Ad

    Displaying In-Feed ads differs from displaying full-screen ads. With In-Feed ads, you must first create a container for the ad. This container is a Layout. You can place said RelativeLayout anywhere on the screen. The ad will scale to any size of container, but keep in mind that very low resolution will make ads less visible. You must then call the Vungle.getNativeAd to get the In-Feed ad object and call the addView function to associate the container with the In-Feed ad.

    private RelativeLayout flexfeedContainer = findViewById(...);

    VungleNativeAd vungleNativeAd = Vungle.getNativeAd("INFEED_ID", vunglePlayAdCallback);if (vungleNativeAd != null) {

    View nativeAdView = vungleNativeAd.renderNativeView();

    flexfeedContainer.addView(nativeAdView);}

    Closing an In-Feed Ad

    Because the In-Feed ad view has been added to your container view, it must also be removed in case the ad view disappears from the screen, the activity or fragment is destroyed, or the parent view container is recycled or destroyed. Without closing the ad, attempting to play another In-Feed ad will cause unexpected behavior in your app.

    private VungleNativeAd vungleNativeAd;

    // Calling finishDisplayingAd when you want to finish displaying In-Feed Ad

    // will trigger onAdEnd and will tell you when you can remove the child

    // In-Feed view container vungleNativeAd.finishDisplayingAd();

    // And removing empty ad view from container

    @Override

    public void onAdEnd(String id, boolean completed) {

    parentView.removeView(nativeAdView);

    vungleNativeAd = null;

    }

    Attaching and Detaching the State of an In-Feed Ad

    If the user scrolls to a point where the video ad is no longer visible on the screen, the Publisher must pause the video, and resume it when it is again visible. To control the pause and resume states, call setAdVisibility from the VungleNativeAd instance, and set it to true when the video is visible and to false when the video goes off screen. The setAdVisibility is not to be confused with View visibility: this setter informs Vungle SDK whether the Native ad view is visible or not, and depending on it, the SDK pauses/resumes video playback.

    To Pause an In-Feed Ad

    vungleNativeAd.setAdVisibility(false);

    To Resume an In-Feed Ad

    vungleNativeAd.setAdVisibility(true);

    MREC Ads

    From SDK version 6.4.11 and above, Vungle supports MREC video ads, which does not require full screen view, similar to In-Feed ad. The container size to render MREC ad is 300 by 250 which is the industry standard. MREC video ads can be set anywhere on the screen and the user can continue using the app while the ad is being played.

    Loading an MREC Ad

    Loading an MREC ad is same as loading a full screen ad. However, the placement must be configured to support MREC feed. Please contact your Vungle account manager to enable MREC for a placement.

    Displaying an MREC Ad

    Since the view size is fixed, the container which is used to display MREC must be specified to be 300dp by 250dp, and the view can be placed anywhere on the screen. This container is a Layout. You can place said RelativeLayout anywhere on the screen. You must then callAdConfig.setAdSize to specify ad size to be AdConfig.AdSize.VUNGLE_MREC and pass this object when callingVungle.getNativeAd to get the MREC ad object. finally call the addView function to associate the container with the MREC ad.

    private RelativeLayout mrecContainer = findViewById(...);

    AdConfig adConfig = new AdConfig();

    adConfig.setAdSize(AdConfig.AdSize.VUNGLE_MREC);

    VungleNativeAd vungleNativeAd = Vungle.getNativeAd("MREC_ID", adConfig, vunglePlayAdCallback);

    View nativeAdView = vungleNativeAd.renderNativeView();

    mrecContainer.addView(nativeAdView);

    Closing an MREC Ad

    Because the MREC ad view has been added to your container view, it must also be removed in case the ad view disappears from the screen, the activity or fragment is destroyed, or the parent view container is recycled or destroyed. Without closing the ad, attempting to play another In-Feed ad will cause unexpected behaviour in your app.

    private VungleNativeAd vungleNativeAd;

    // Calling finishDisplayingAd when you want to finish displaying MREC Ad

    // will trigger onAdEnd and will tell you when you can remove the child

    // MREC view container vungleNativeAd.finishDisplayingAd();

    // And removing empty ad view from container

    @Override

    public void onAdEnd(String id, boolean completed) {

    parentView.removeView(nativeAdView);

    vungleNativeAd = null;

    }

    Attaching and detaching the state of an MREC Ad

    If the user scrolls to a point where the video ad is no longer visible on the screen, the Publisher must pause the video, and resume it when it is again visible. To control the pause and resume states, call setAdVisibility from the VungleNativeAd instance, and set it to true when the video is visible and to false when the video goes off screen. The setAdVisibility is not to be confused with View visibility: this setter informs Vungle SDK whether the native ad view is visible or not, and depending on it, the SDK pauses/resumes video playback.

    To Pause an MREC Ad

    vungleNativeAd.setAdVisibility(false);

    To Resume an MREC Ad

    vungleNativeAd.setAdVisibility(true);

    Advanced Settings

    Google Play Services (Optional)

    Including Google Play Services with your project allows Vungle to provide a more customized ad experience to the end user. Including basement and ads-identifier APIs are optional but recommended. We recommend using version 11.0.1 or higher.

    To include Google Play Services, we recommend Google's setup guide. In your app, ensure that the device has a sufficiently updated version of Google Play Services. Vungle SDK optionally utilizes the location and ads API from Google Play Services.

    google.android.gms:play-services-basement:16.0.0 // Recommended

    google.android.gms:play-services-ads-identifier:16.0.0 // Required for AAID

    Method Count Reduction

    Adding Vungle Android SDK v6 to your project will add approximately 700 core Vungle methods, excluding any transitive dependencies. A full integration including third-party libraries is expected to add less than 4000 methods in average. Consider the following suggestions to reduce the total number of methods added to your project.

    ProGuard: You can enable ProGuard to shrink your project code. It will discard any unused classes at the time of compilation to make the total method count as small as possible. You can enable it by specifying minifyEnabled true in build.gradle for appropriate build type and by providing the rules to keep the classes that is required by your project.

    Multidex: If you are still above a 65K method count, enabling multiDex may be the only solution provided by Google. You need to configure your project to multiDex only one time, but it will have an impact on build and app startup time.

    Proguard

    If you are using Proguard, add the following rules to your ProGuard configuration file:

    # Vungle

    -keep class com.vungle.warren.** { *; }

    -keep class com.vungle.warren.downloader.DownloadRequest

    -dontwarn com.vungle.warren.error.VungleError$ErrorCode

    -dontwarn com.vungle.warren.downloader.DownloadRequest$Status-keepclassmembers enum com.vungle.warren.** { *; }

    # Moat SDK

    -keep class com.moat.** { *; }

    -dontwarn com.moat.**

    -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement

    -keepattributes *Annotation*

    # Retrofit

    -keepattributes Signature, InnerClasses

    -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement

    -dontwarn javax.annotation.**

    -dontwarn kotlin.Unit

    -dontwarn retrofit2.-KotlinExtensions

    -keepclassmembers,allowshrinking,allowobfuscation interface * {

    @retrofit2.http.* <methods>;

    }

    # Okio+OkHttp

    -dontwarn okhttp3.**

    -dontwarn okio.**

    -dontwarn javax.annotation.**

    -dontwarn org.conscrypt.**

    -keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase

    -keepclassmembers class * extends com.vungle.warren.persistence.Memorable {

    public <init>(byte[]);

    }

    Minimum disk space

    Minimum disk space configuration was introduced in v6.4.11 to determine the limits for available space on a users device before the Vungle SDK initializes and fetch ads. Default value for setMinimumSpaceForInit is 51 MB and setMinimumSpaceForAd is 50 MB. The size is entered in bytes.

    VungleSettings vungleSettings = new VungleSettings.Builder()

    .setMinimumSpaceForInit(51L * 1024L * 1024L) // 51 MB

    .setMinimumSpaceForAd(50L * 1024L * 1024L) // 50 MB

    .build();

    Vungle.init(appId, getApplicationContext(), initCallback, vungleSettings);

    Restrict usage of device ID

    For Android SDK version 6.4.11 onwards, publishers can now restrict from passing Android ID from the device to the SDK.

    // Set true to opt out for Android ID collection by SDK or false (default) to opt in

    VungleSettings vungleSettings = new VungleSettings.Builder()

    .setAndroidIdOptOut(true)

    .build();

    Vungle.init(appId, getApplicationContext(), initCallback, vungleSettings);

    Ad Configuration Options

    Ad Configuration

    You have the option to customize individual ads you play by providing a new adConfig object to playAd. AdConfig is an object and can be null, in which case the ad will play with default configurations; or it can be a non-null with overrides to the AdConfig setter. The following is an example of how to use AdConfig

    Vungle.playAd(placementReferenceID, adConfig, vunglePlayAdCallback);

    The above uses adConfig object that has customization option configuration and you set theAdConfig object as shown here

    AdConfig adConfig = new AdConfig();

    adConfig.setAutoRotate(true);

    adConfig.setMuted(true);

    Vungle.playAd(placementReferenceID, adConfig, vunglePlayAdCallback);

    The following table shows all the available AdConfig options.

    Option

    Description

    setBackButtonImmediatelyEnabled

    true if back button should be enabled before ad close button appears, false otherwise

    setAutoRotate

    true if the video ad is supposed to auto-rotate, false to follow video ad orientation

    setMuted

    false if the video should start with its audio settings matching those of your enclosing application, true if it should start muted regardless

    setOrdinal

    Takes an Integer value of ordinal count to track the number of ads that has been played in same session

    Note: You may use the same AdConfig object for multiple ads Placement Reference IDs you play.

    Customizing Rewarded Ads

    The pop-up message dialog for rewarded ads is configurable with setIncentivizedFields method.

    public static void setIncentivizedFields(@Nullable String userID, @Nullable String title, @Nullable String body, @Nullable String keepWatching, @Nullable String close)

    List of Valid Placements

    A helper method that returns Collection of String containing all valid Placement Reference IDs for the current session.

    public static Collection getValidPlacements()

    GDPR Recommended Implementation Instructions

    As of May 25th, the General Data Protection Regulation (GDPR) will be enforced in the European Union. To comply with GDPR, developers have two options.

    Option 1 (recommended): Publisher controls the GDPR consent process at the user level, then communicates the users choice to Vungle. To do this, developers can collect the users consent using their own mechanism, and then use Vungle APIs to update or query the users consent status. Refer to the GDPR Recommended Implementation Instruction section for details.

    Option 2: Allow Vungle to handle the requirements. Vungle will display a consent dialog before playing an ad for a European user, and will remember the users consent or rejection for subsequent ads.

    The updateConsentStatus method (as recommended in Option 1) takes user consent status and consent message version as its parameters.

    public static void updateConsentStatus(@NonNull Consent status, @NonNull String consentMessageVersion)

    The consent status will specify whether the user has OPTED_IN or OPTED_OUT for the message being displayed by the publisher. The consentMessageVersion indicates publisher controlled consent policy version to allow publisher getting consent again when GDPR policy changes by pooling users by the message version.

    // Usage example of GDPR API

    // To set the user's consent status to opted in:

    Vungle.updateConsentStatus(Vungle.Consent.OPTED_IN, 1.0.0);

    // To set the user's consent status to opted out:

    Vungle.updateConsentStatus(Vungle.Consent.OPTED_OUT, 1.0.0);

    // To find out what the user's current consent status is:

    // This will return null if the GDPR Consent status has not been set

    // Otherwise, it will return Vungle.Consent.OPTED_IN or Vungle.Consent.OPTED_OUT

    Vungle.Consent currentStatus = Vungle.getConsentStatus();

    String consentMessageVersion = Vungle.getConsentMessageVersion();

    Hardware Acceleration

    Hardware acceleration Hardware acceleration is enabled by default for your application if your target API level is set to 14 or above. This option must be enabled for the SDK to properly show Dynamic Template and Native Flex ads. Make sure this option is set to 'true' at application level of your project.

    <application android:hardwareAccelerated="true" ...>

    Retrieving the SDK Version Number

    To programmatically retrieve the SDK version number at runtime (this useful in internal mediation), Vungle provides the following String:

    com.vungle.warren.BuildConfig.VERSION_NAME

    Debugging Exception Code

    InitCallback, PlayAdCallback and LoadAdCallback will have VungleException code when onError callback fires. You can use the code to debug or take actions to correct the issue programmatically.

    if (throwable instanceof VungleException &&

    ((VungleException) throwable).getExceptionCode() == VungleException.VUNGLE_NOT_INTIALIZED) {

    // call routine to initialize SDK

    }

    Exception Code

    Description

    CONFIGURATION_ERROR

    Configuration Error Occurred. Please check your app ID and placement reference IDs, and try again when network connectivity is available.

    NO_SERVE

    Ad server found no advertisements are available for your current bid. Please try again later. Occurrence of this exception is expected behavior.

    UNKNOWN_ERROR

    Unknown Error Occurred. Occurrence of this exception should be rare.

    AD_EXPIRED

    The advertisement in the cache has expired and can no longer be played. Please load another ad.

    MISSING_REQUIRED_ARGUMENTS_FOR_INIT

    Please ensure all parameter for init marked as NonNull are provided, as they are essential for functioning of our SDK.

    APPLICATION_CONTEXT_REQUIRED

    Please provide Application context so our SDK can continue to support our API beyond Activity lifecycle.

    OPERATION_ONGOING

    There is already an ongoing operation for the action you requested. Please wait until the operation finished before starting another.

    VUNGLE_NOT_INTIALIZED

    Vungle is not initialized or no longer initialized. Please call Vungle.init() to reinitialize.

    AD_UNABLE_TO_PLAY

    Unable to play advertisement.

    AD_FAILED_TO_DOWNLOAD

    Advertisement failed to download.

    PLACEMENT_NOT_FOUND

    Placement is not valid.

    SERVER_RETRY_ERROR

    Remote Server responded with http Retry-After, SDK will retry this request.

    Configuring Auto Backup for JAR Integration

    The Allow backup setting is enabled by default for your application for API 23 or above.The backup rule ensures that all application data is backed up for proper operation of Vungle SDK and application itself. If you have not disabled the allow backup setting or specified your own backup rules, you must provide additional .xml rules to define which files in our SDK file system should be excluded from automatic backup.

    Vungle Exclusion Rules

    <full-backup-content>

    <exclude domain="file" path="vungle" />

    <exclude domain="file" path="vungle_cache" />

    <exclude domain="external" path="vungle_cache" />

    <exclude domain="database" path="vungle_db" />

    <exclude domain="sharedpref" path="com.vungle.sdk.xml" />

    </full-backup-content>

    Gradle Integration with Developer Backup Rules

    Add Vungle SDK exclusion rules to the existing .xml file that has your apps own exclusion rules.

    Configure fullBackupContent to be replaced on the application level and add the Vungle SDK exclusion rule to the existing .xml.

    JAR Integration with developer backup rules

    Create a new XML file with Vungle exclusion rules.

    Place the .xml file under the res/xml directory.

    Add fullBackupContent in the application tag of AndroidManifest.xml with the file name of the .xml file you created above.

    <application

    android:fullBackupContent="@xml/vungle_backup_rule">

    Disabling Auto Backup

    If backup is not required for your app, you can simply disable it on the application tag:

    <application

    android:allowBackup="false" >

    View Article
  • You can obtain a Reporting API Key on the Vungle Dashboard as follows:

    View Article
  • Video ads allow app developers more flexibility in how to integrate adsin their app. You can make the videoads opt-in or auto-play, skippable or non-skippable, and rewarded or non-rewarded. The best placements tend to be unique to the app and integrated into the game-play. Our Account Management team offers hands-on support to come up with the best placement(s) for your app. You can contact them directly at [email protected].

    Check out our Best Practices Guide for examples of creative ad placements.

    View Article
  • Creative Approval SLA

    All Creatives added to the Vungle network will be reviewed to ensure correct formatting as well as content safety. Normally, it will take approximately 1 business day to approve a new creative.

    Reasons for Creative Rejections

    Creative must be in the correct format for Vungle required dimensions

    Assets (videos & images) are blurry, cut off, broken, or using the wrong orientation

    Refer to our Creative Asset Requirement article

    Content must be appropriate by Vungle requirements. Below are possible reasons for rejection:

    Excessive depictions of the following:

    Drugs and alcohol use

    Adult content

    Profanity

    Violence and gore

    Prohibited content:

    Illegal products or services

    Discriminatory practices or depictions

    Sale or use of Drugs/Drug-Related Products

    Third-Party Infringement

    Creative must be relevant, appropriate, and accurate to the company, product, service, or brand that it is advertising

    View Article
  • Adding creatives to your Advertiser accounts campaigns is simple. Using our creative builders templates add the following creatives.

    Dynamic Interstitial

    Learn about approvals.

    Designed for either landscape or portrait video and optimized for interstitials.

    Features

    Video

    Video With Endcard User Experience

    Assets

    Video (16:9)

    Dimensions: 1920x1080px or 1280x720px

    File Size: 30MB to 60MB *Recommended

    Duration: 15-30sec*Recommended

    Format: MP4

    Square Dynamic Interstitial

    Designed for a square video that seamlessly fits all phone orientations.

    Features

    Video

    Video With Endcard User Experience

    Assets

    Video (1:1)

    Dimensions: 1080x1080px or 720x720px

    File Size: 30MB to 60MB*Recommended

    Duration: 15-30sec*Recommended

    Format: MP4

    Showcase

    Endcard has automatic animations to shuffle through product images.

    Features

    Video

    Images (3-5)

    Video Then Endcard User Experience

    Assets

    Video (16:9)

    Dimensions: 1920x1080px or 1280x720px

    File Size: 30MB to 60MB*Recommended

    Duration: 15-30sec*Recommended

    Format: MP4

    Images (3-5) (1:1)

    Dimensions: 900x900px

    File Size: Under 150KB*Recommended

    Format: PNG or JPG

    Looping

    Optimal for shorter, catchy videos, that allows the video to repeat infinitely.

    Features

    Video

    Video With Endcard User Experience

    Assets

    Video (16:9)

    Dimensions: 1920x1080px or 1280x720px

    File Size: 30MB to 60MB*Recommended

    Duration: 15-30sec*Recommended

    Format: MP4

    Carousel

    Endcard supports multiple images encouraging users to browse images.

    Features

    Video

    Images (3-5)

    Video Then Endcard User Experience

    Assets

    Video (16:9)

    Dimensions: 1920x1080px or 1280x720px

    File Size: 30MB to 60MB*Recommended

    Duration: 15-30sec*Recommended

    Format: MP4

    Images (16:9) (3-5)

    Dimensions: 390x695px *Minimum / vertical*Recommended

    File Size: Under 150KB*Recommended

    Format: PNG or JPG

    Gradient

    Simplified endcard with a full screen image and overlayed CTA.

    Features

    Video

    Images (2)

    Video Then Endcard User Experience

    Assets

    Video (16:9)

    Dimensions: 1920x1080px or 1280x720px

    File Size: 30MB to 60MB*Recommended

    Duration: 15-30sec*Recommended

    Format: MP4

    Images (16:9) (2)

    Dimensions: 1707x960px horizontal or 960x1707px vertical

    File Size: Under 150KB*Recommended

    Format: PNG or JPG

    Swipe

    Fullscreen video, encouraging user interaction without interfering video visibility

    Features

    Video

    Video With Endcard User Experience

    Assets

    Video (16:9)

    Dimensions: 1920x1080px or 1280x720px

    File Size: 30MB to 60MB*Recommended

    Duration: 15-30sec*Recommended

    Format: MP4

    Approval

    Creatives created in the Advertiser Self-Serve Platform will need to be approved by our internal team.

    View Article
  • This is version 2.1.0 (August 2017) of the Vungle OpenRTB 2.3Integration Guide.This article specifies the details for integrating with Vungle Exchange using OpenRTB 2.3.

    1. Request and Response

    1.1 Entity

    All entities in this section are a subset of the OpenRTB 2.3.1 spec; should there be missing fields or requirements, please default requirements to the spec itself.

    1.2 Versioning

    Over time, some fields become obsolete, so, to ensure maximum compatibility, Vungle Exchange will respect all "deprecated" fields specified in the most recent Vungle OpenRTB spec. All "deprecated" fields are scheduled for removal at the next specification update, at which point Vungle Exchange is relieved of the responsibility to maintain deprecated fields.

    All removed fields will still remain in the specification with a "deleted" label to indicate that the field is no longer supported. We use the "deleted" label to enforce a specification semantic: Every field, once defined, remains unique in the scope for which it was defined for the lifetime of the spec. This means that if the 'id' field ever becomes deprecated and then removed in a particular spec, it will never be resurrected in a future revision with a different meaning.

    1.2.1 Semantic Versioning

    Specification versioning will also follow Semver 2.0.0 guidelines, namely:

    A major version update can break backward compatibility; for example, a field that is "deprecated" in version X is "removed" in version X+1.

    A minor version update should not break backward compatibility; examples include a field that is in use being marked as "deprecated"; or a required field being marked as as non-required and deprecated.

    A patch version update must not break backward compatibility; for example, correcting a typo in specification description.

    1. Request

    2.1 Required and Optional Fields

    Notes about the Required column in upcoming sections:

    Yes: Downstream consumption of such a field can always expecta well-formatted, non-empty value based on the type specified.

    No: Downstream consumption should not expect the existence of such field, or the validity of value. Consumer validation on the value is required, unnecessary for the type.

    Default: All unmentioned fields in OpenRTB 2.3.1 default to not required.

    2.2 Protocol Negotiation

    Vungle Exchange supports communicating over HTTP/2 through protocol negotiation; otherwise, the default is HTTP/1.1.

    2.3 Request Headers

    Each bid request will have the following custom HTTP headers as specified by OpenRTB protocol:

    X-OpenRTB-Version: 2.3

    In addition to custom HTTP headers, Vungle Exchange also attaches the following standard headers:

    Content-Type: application/jsonAccept: application/json

    Finally, Vungle Exchange attaches a custom header to indicate the Vungle OpenRTB spec revision:

    X-Vungle-OpenRTB-Version: 2

    2.4 BidRequest Object

    Field

    Type

    Required

    Description

    id

    string

    yes

    Bid request ID generated by VungleExchange; for example, '570b0eb14e67c98f761a0ca0'.

    imp

    object array

    yes

    See the Impression object.

    app

    object

    yes

    See the Application object.

    device

    object

    yes

    See the Device object.

    at

    integer

    yes

    Type of auction; for example, '2' for second-price auction. Vungle Exchange only runs second-price auctions, so this value is always '2'.

    tmax

    integer

    yes

    Maximum time in milliseconds to submit a complete bid response; this value is always '250'.

    cur

    string array

    no

    List of allowed currencies for the auction in ISO-4217-alpha; for example, ["USD", "CNY", "EUR"]. We currently only support "USD".

    bcat

    string array

    no

    Refer to OpenRTB 2.3.1 section 5.1.

    regs

    object

    no

    Refer to OpenRTB 2.3.1 section 3.2.16.

    test

    integer

    no

    Whether the auction is in test mode (1), or live mode (0); test auctions are not billable.

    2.4.1 Impression Object

    Field

    Type

    Required

    Description

    id

    string

    yes

    Impression ID generated by Vungle Exchange; for example, '3a06eb14e67c98f761add01'.

    displaymanager

    string

    yes

    Supply-side display manager; Vungle uses this field to specify the SDK technology used, because we distinguish between SDK mobile platforms; for example, 'Vungle' for iOS, 'VungleDroid' for Android, and 'VungleWindows' for Windows, followed by the SDK version in the next field.

    displaymanagerserver

    string

    yes

    Supply-side display manager version; Vungle uses this to specify the SDK version; for example, '3.3.1'.

    bidfloor

    float

    yes

    Minimum bid price for a bid to be eligible; for example, '8.72'.

    bidfloorcur

    string

    yes

    Currencies for the impression in ISO-4217-alpha; for example, 'USD'.

    video

    object

    no

    See the Video object.

    tagid

    string

    no

    Placement reference ID corresponding to the given impression; for example,, 'placement_name_1af44fda'.

    instl

    integer

    no

    Whether the impression represents full screen/interstitial (1), or not (0). Currently, Vungle Exchange supports full screen/interstitial (1) only.

    secure

    integer

    no

    Flag to indicate if the impression requires secure HTTPS URL creative assets and markup, where 0 = non-secure and 1 = secure.

    Vungle always requires secure (1) assets and markup.

    ext

    object

    no

    2.4.2 Video Object

    Field

    Type

    Required

    Description

    mimes

    string array

    yes

    Content MIME types supported. Vungle Exchange only supports ["video/mp4"].

    h

    integer

    yes

    Height of the video.

    w

    integer

    yes

    Width of the video.

    minduration

    integer

    no

    Minimum number of seconds for which the video must play.

    maxduration

    integer

    no

    Maximum number of seconds for which the video may play.

    delivery

    integer array

    no

    Supported list of video delivery methods: (progressive or streaming). Refer to OpenRTB 2.3.1 section 5.13.

    minbitrate

    integer

    no

    Minimum bid rate in kbps. Vungle Exchange currently only supports 250.

    maxbitrate

    integer

    no

    Maximum bid rate in kbps; for example, 500.

    protocols

    integer array

    no

    Refer to OpenRTB 2.3.1 section 5.8; for example, [2, 5].

    boxingallowed

    integer

    no

    Whether boxing the video is allowed (1) or not (0). The value for this is always '1'.

    playbackmethod

    integer array

    no

    Refer to OpenRTB 2.3.1 section 5.9.

    startdelay

    integer

    no

    Refer to OpenRTB 2.3.1 section 5.10. The value for this is always '0'.

    2.4.3 Application Object

    Field

    Type

    Required

    Description

    id

    string

    yes

    Exchange-specific ID. For Vungle, this is the app store ID; for example, '3709293'. The value is also synonymous with the app.id value from the SDK request. This ID may mean nothing to the DSP, but may be used by the DSP to compare and reconcile reporting disputes.

    bundle

    string

    yes

    The unique market ID, this is a platform-specific application identifier intended to be unique to the app and independent of VungleExchange. - On Android, this should be a bundle or package name (for example, 'com.supercell.hayday'). - On iOS, it is a numeric ID.

    publisher

    object

    yes

    See the Publisher object.

    name

    string

    no

    Application name; for example, 'Hay Day'.

    storeurl

    string

    no

    App store URL; for example, 'https://itunes.apple.com/us/app/hay-day/id506627515?mt=8#'.

    cat

    string array

    no

    Refer toRefer to OpenRTB 2.3.1 section 5.1.

    privacypolicy

    integer

    no

    Whether the application has a privacy policy (1), or not (0). Vungle Exchange only supports '1' for this field.

    paid

    integer

    no

    Whether the application is paid (1), or not (0).

    keywords

    string

    no

    Comma-separated list of tags for the publisher application.

    ext

    object

    no

    2.4.4 Application Extension

    Field

    Type

    Required

    Description

    altid

    string

    no

    A secondary Vungle Exchange-specific ID uniquely identifying the publisher application; for example, '3a06eb14e67c98f761add01'.

    sdk

    object

    no

    See the SDK Extension object.

    wtags

    string array

    no

    Publisher application tags whitelist.

    btags

    string array

    no

    Publisher application tags blacklist.

    bundleid

    string

    no

    Application bundle identifier or package name.

    tags

    string array

    no

    Deprecated; use keywords.

    bundleid

    string

    no

    Application bundle identifier or package name.

    2.4.5 SDK Extension

    Field

    Type

    Required

    Description

    name

    string

    yes

    A string that identifies an SDK family of the SDK agent installed on the host application. For example, 'VungleDroid', 'Vungle', or 'VungleWindows'.

    ver

    string

    yes

    String describing the version of the SDK agent installed on the host application.

    plugin

    string

    no

    Name of the SDK plugin with which the SDK agent is built; for example, 'native', 'unity'.

    pluginver

    string

    no

    Version of the SDK plugin with which the SDK agent is built; for example, '1.0'.

    2.4.6 Publisher Object

    Field

    Type

    Required

    Description

    id

    string

    yes

    Publisher ID generated by Vungle Exchange, for example, '570ffeb14e67998f761a791c'.

    name

    string

    no

    Publisher name; for example, 'Supercell Oy'.

    cat

    string array

    no

    Refer to OpenRTB 2.3.1 section 5.1.

    2.4.7 Device Object

    Field

    Type

    Required

    Description

    ua

    string

    yes

    Device browser user agent string; for example, 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1'.

    ip

    string

    yes

    Not required when ipv6 field is present.

    This is the IP address of the impression; for example, '212.14.27.104'.

    ipv6

    string

    yes

    Not required when ip field is present.

    IPv6 address of the impression; for example, '3ffe:1900:4545:3:200:f8ff:fe21:67cf'.

    h

    integer

    yes

    Device screen height in pixels.

    w

    integer

    yes

    Device screen width in pixels.

    connectiontype

    string

    yes

    Refer to OpenRTB 2.3.1 section 5.18.

    ifa

    string

    yes

    ID sanctioned for advertiser use in clear text; for example, 'e4fe9bdecaa047b6908dffba3fa184f2'.

    geo

    object

    no

    See the Geo object.

    make

    string

    no

    Device make.

    model

    string

    no

    Device model.

    os

    string

    no

    Device OS; for example, 'iOS', 'Android'.Enum value of: - 'iOS' - 'Android' - 'Windows'

    osv

    string

    no

    Device OS version; for example, '9.1', '8.0'.

    dnt

    integer

    no

    Whether the device specifies "Do Not Track" (1), or not (0).

    lmt

    integer

    no

    Whether the device specifies "Limited Ad Tracking" (1), or not (0).

    devicetype

    string

    no

    Refer to OpenRTB 2.3.1 section 5.17.

    language

    string

    no

    Device language in ISO-639-1-alpha-2; for example, 'en'.

    carrier

    string

    no

    Carrier or ISP; for example, 'VERIZON'.

    ext

    object

    no

    See the Device Extension object.

    2.4.8 Device Extension

    Field

    Type

    Required

    Description

    tz

    string

    no

    Device timezone settings formatted as zone name in the IANA timezone database; for example, 'America/Los_Angeles'.

    vungleua

    string

    no

    Deprecated: Use Application.ext.vungle.sdk

    sdcard

    integer

    no

    Whether SD card storage is available for Android devices (1) or not (0).

    volume

    float

    no

    Value between 0 and 1 denoting the percentage volume of the device.

    muted

    integer

    no

    0 = false 1 = true; enumeration needed.

    idfv

    string

    no

    ID for vendor on iOS devices; an alphanumeric string that uniquely identifies a device to the apps vendor; for example, '00000000-0001-4d3a-8f98-233623cd8d12'.

    The same device may contain different IDFV values depending on whether the app in the bid request belongs to a different vendor.

    marketplace

    string

    no

    The app marketplace installed on the device. Possible values are:

    'google'

    'apple'

    'amazon'

    is_sideload_enabled

    integer

    no

    Boolean flag indicating whether the device allows app installs from "unknown" sources. If '1' (true), then apps from unknown marketplaces are allowed. If '0' (false), they are not.

    2.4.9 Geo Object

    Field

    Type

    Required

    Description

    country

    string

    yes

    Country code in ISO-3166-1-alpha-3; for example, 'USA'.

    lat

    float

    no

    Latitude of the device; for example, '[-90, 90]'.

    long

    float

    no

    Longitude of the device; for example, '[-180, 180]'.

    type

    integer

    no

    Refer to OpenRTB 2.3.1 section 5.16.

    region

    string

    no

    Region code in ISO-3166-2; 2-letter state code if USA; for example, 'CA'.

    city

    string

    no

    Free-form city name.

    zip

    string

    no

    Postal code.

    utcoffset

    integer

    no

    Local time as the number +/- of minutes from UTC.

    2.4.10 User Object

    Field

    Type

    Required

    Description

    ext

    object

    no

    See the User Extension object.

    2.4.11 User Extension

    Field

    Type

    Required

    Description

    consent

    integer

    no

    The user consent string is optional, but present if the request is subject to GDPR regulations (that is, Regs.ext.gdpr = 1). The default sense of consent under GDPR is opt-out. Therefore an omitted consent string in a request subject to GDPR is interpreted as equivalent to the user fully opting out of all defined purposes for data use by all parties.

    0 - all PII scrubbed

    1 - user has given consent

    2.4.12 Regs Object

    Field

    Type

    Required

    Description

    coppa

    integer

    no

    Flag indicating whether this request is subject to the COPPA regulations established by the USA FTC, where 0 = no and 1 = yes.

    ext

    object

    no

    Placeholder for Vungle Exchange-specific extensions to OpenRTB. See Regs Extension.

    2.4.13 Regs Extension

    Field

    Type

    Required

    Description

    gdpr

    integer

    no

    Flag indicating if this request is subject to the GDPR regulations.

    0 = no

    1 = yes

    2.4.14 PMP Object

    Field

    Type

    Required

    Description

    private_auction

    integer

    no

    Indicator of auction eligibility to seats named in the Direct Deals object, where 0 = all bids are accepted, 1 = bids are restricted to the deals specified and the terms thereof.

    deal

    object array

    no

    Array of Deal (Section 3.2.18) objects that convey the specific deals applicable to this impression.

    ext

    object

    no

    Placeholder for Vungle Exchange-specific extensions to OpenRTB.

    3. Response

    3.1 Required and Optional Fields

    Notes about the Required column in the Response section:

    Yes:Vungle Exchange assumes a required field to be always formatted as specified, non-empty, with the type specified; invalid values may result in ineligibility for auction.

    Recommended:Vungle Exchange will use the field to assist in the auction process if the value of the field is formatted as specified; a missing or invalid field does not negatively impact the eligibility in auction.

    No: Vungle Exchange does not require that the fields exist.

    Default: All unmentioned fields in OpenRTB 2.3.1 have a default requirement of 'No'. Additionally, all fields must match the type specified, or they may negatively affect auction eligibility.

    3.2 Response Headers

    Response headers must contain the "Content-Type" and "X-OpenRTB-Version" header with one of the accepted values from the request headers above. For example,

    Content-Type: application/json

    X-OpenRTB-Version: 2.3

    3.3 Response Status Code

    All responses must be either 200 or 204. Any other other HTTP response code can negatively affect the DSP's auction eligibility.

    3.4 No-Bid Reason Signaling

    DSPs are advised to send no-bid reasons when deciding to not bid. This information can help Vungle Exchange detect and fix potential issues with integration. No-bid signaling should follow the OpenRTB 2.3.1 section 7.4 specification. A well formed no-bid signaling with the no-bid reason should look like this:

    {"id": "1234567890", "seatbid": [], "nbr": 2}

    3.5 BidResponse Object

    Field

    Type

    Required

    Description

    id

    string

    yes

    BidRequest ID generated by Vungle Exchange; for example, '570ffeb14e67998f761a791c'. This must match the id in the BidRequest object.

    bidid

    string

    no

    A unique bidder-generated response ID to assist with logging/tracking.

    cur

    string

    no

    Bid currency using ISO-4217 alpha codes. Vungle Exchange currently supports only USD and treats any value as USD.

    seatbid

    object array

    yes

    Array of seatbid objects; 1+ required if a bid is to be made.

    nbr

    integer

    no

    A reason for not bidding, as listed in 5.19 of the OpenRTB 2.3.1 spec.

    ext

    object

    no

    3.5.1 SeatBid Object

    Field

    Type

    Required

    Description

    seat

    string

    no

    ID of the bidder seat on whose behalf this bid is made. Refer to OpenRTB 2.3.1.

    bid

    object array

    yes

    See the Bid object. At least one bid must exist.

    3.5.2 Bid Object

    Field

    Type

    Required

    Description

    id

    string

    yes

    Bid ID generated by individual DSPs.

    impid

    string

    yes

    Impression ID with respect to the bid request's impression for which it is bidding. Must match the ID in the bid request Impression object.

    price

    float

    yes

    Bid price expressed in unit of CPM; for example, '10.30'.

    nurl

    string

    no

    Win notice URL called by Vungle Exchange if the bid wins.

    adm

    string

    yes

    Ad markup to serve after winning auction. See the Ad Markup Specification section.

    cid

    string

    recommended

    Campaign ID proxied by DSP.

    crid

    string

    recommended

    Creative ID proxied by DSP.

    adomain

    string array

    recommended

    Advertiser domains for block list checking; for example, ["supercell.com"].

    bundle

    string

    recommended

    The unique market ID, this is a platform-specific application identifier intended to be unique to the app and independent of the Vungle Exchange. - On Android, this should be a bundle or package name (for example, 'com.supercell.hayday'). - On iOS, it is a numeric ID.

    h

    integer

    recommended

    Height of the creative.

    w

    integer

    recommended

    Width of the creative.

    cat

    string array

    no

    IAB content categories; Refer to OpenRTB 2.3.1 section 5.1.

    iurl

    string

    no

    Lost notification URL.

    dealid

    string

    no

    Reference to the deal.id from the BidRequest object if this bid pertains to a private marketplace direct deal.

    adid

    string

    no

    ID of a preloaded ad to be served if the bid wins.

    ext

    object

    no

    4. Examples

    4.1 Request Example

    {

    "id": "58ed309efa8936087efd1349",

    "imp": [{

    "id": "58ed309efa8936087efd134a",

    "video": {

    "mimes": ["video/mp4"],

    "minduration": 5,

    "maxduration": 30,

    "protocols": [2, 5],

    "w": 1080,

    "h": 1920,

    "startdelay": 0,

    "linearity": 1,

    "minbitrate": 250,

    "maxbitrate": 2500,

    "boxingallowed": 1,

    "playbackmethod": [1, 2, 3, 4],

    "delivery": [1, 2],

    "pos": 7

    },

    "displaymanager": "Vungle",

    "displaymanagerver": "3.3.5",

    "instl": 1,

    "bidfloor": 15,

    "bidfloorcur": "USD"

    }],

    "app": {

    "id": "56b8e577819502560b000033",

    "name": "test-pub-app-name",

    "bundle": "1045826890",

    "storeurl": "https://itunes.apple.com/us/app/id1234567?mt=8",

    "cat": [

    "IAB1"

    ],

    "privacypolicy": 1,

    "publisher": {

    "id": "test-pub-app-id",

    "name": "test-pub-app-name",

    "cat": [

    "IAB1"

    ]

    },

    "ext": {

    "vungle": {

    "altid": "5fff577819502560b000033",

    "btags": ["real money gambling", "social casino"],

    "wtags": ["targeted tag", "social"]

    }

    }

    },

    "device": {

    "ua": "Mozilla/5.0 (iPhone; CPU iPhone OS 8_4 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12H141",

    "geo": {

    "lat": 47.46,

    "lon": -122.16,

    "type": 1,

    "country": "USA",

    "region": "WA",

    "city": "San Francisco",

    "zip": "94103"

    },

    "dnt": 0,

    "lmt": 0,

    "ip": "192.168.1.1",

    "devicetype": 1,

    "make": "Samsung",

    "model": "SM-J200G",

    "connectiontype": 2,

    "os": "iOS",

    "osv": "8.0",

    "w": 1080,

    "h": 1920,

    "js": 1,

    "language": "en",

    "ifa": "test-ifa",

    "ext": {

    "vungle": {

    "isSdCardAvailable": 1,

    "vungleua": "VungleDroid/3.3.5",

    "tz": "Europe/Kaliningrad",

    "sdcard": 1,

    "volume": 0.13333334,

    "muted": 1

    }

    }

    },

    "bcat": ["IAB7-3", "IAB7-5", "IAB7-28", "IAB7-29", "IAB7-30", "IAB7-39", "IAB7-41", "IAB7-42"],

    "at": 2,

    "cur": ["USD"],

    "tmax": 250

    }

    4.2 Response Example

    {

    "id": "58ed309efa8936087efd1349",

    "bidid": "5508",

    "cur": "USD",

    "seatbid": [

    {

    "seat": "7735",

    "bid": [

    {

    "id": "5508",

    "impid": "58ed309efa8936087efd134a",

    "price": 50,

    "nurl": "http://bidder.com/won?price=${AUCTION_PRICE}",

    "adm": "<VAST version=\"2.0\"><Ad><InLine><AdTitle>YOUR_AD_NAME</AdTitle><Impression><![CDATA[https://YOUR_IMPRESSION_TRACKING_URL?ttdsp_price=${AUCTION_PRICE}]]></Impression><Creatives><Creative id=\"YOUR_CREATIVE_ID\"><Linear><Duration>00:00:18</Duration><TrackingEvents><Tracking event=\"start\"><![CDATA[https://YOUR_IMPRESSION_TRACKING_URL_START_PLAY]]></Tracking><Tracking event=\"complete\"><![CDATA[https://YOUR_IMPRESSION_TRACKING_URL_START_COMPLETE]]></Tracking></TrackingEvents><VideoClicks><ClickThrough><![CDATA[https://YOUR_DESTINATION_URL_TO_DOWNLOAD_BY_CLICK]]></ClickThrough><ClickTracking><![CDATA[https://YOUR_CLICK_TRACKING_URL]]></ClickTracking></VideoClicks><MediaFiles><MediaFile delivery=\"progressive\" type=\"video/mp4\" width=\"1280\" height=\"720\"> <![CDATA[https://YOUR_AD_VIDEO.mp4]]></MediaFile></MediaFiles></Linear></Creative></Creatives><Description>Longer description of ad</Description></InLine></Ad></VAST>",

    "cid": "554d550b418461cc3700014d",

    "crid": "57767c29a63510e75f000073"

    }

    ]

    }

    ]

    }

    5. Ad Markup Specification

    Vungle Exchange supports primarily three types of markups: VAST, MRAID, and proprietary Vungle Ad Markup. While each has its high-level specification, to be considered as a valid markup for performance reasons, it must also comply with the additional requirements below.

    5.1 VAST

    The following tag must appear in the first 100 bytes of the 'adm' field, or the payload of the 'nurl' response:

    <VAST version="2.0">

    <Ad>

    <InLine>

    <AdTitle>

    YOUR_AD_NAME

    </AdTitle>

    <Impression>

    <![CDATA[https://YOUR_IMPRESSION_TRACKING_URL?ttdsp_price=${AUCTION_PRICE}]]>

    </Impression>

    <Creatives>

    <Creative id="YOUR_CREATIVE_ID">

    <Linear>

    <Duration>00:00:18</Duration>

    <TrackingEvents>

    <Tracking event="start">

    <![CDATA[https://YOUR_IMPRESSION_TRACKING_URL_START_PLAY]]>

    </Tracking>

    <Tracking event="complete">

    <![CDATA[https://YOUR_IMPRESSION_TRACKING_URL_START_COMPLETE]]>

    </Tracking>

    </TrackingEvents>

    <VideoClicks>

    <ClickThrough>

    <![CDATA[https://YOUR_DESTINATION_URL_TO_DOWNLOAD_BY_CLICK]]>

    </ClickThrough>

    <ClickTracking>

    <![CDATA[https://YOUR_CLICK_TRACKING_URL]]>

    </ClickTracking>

    </VideoClicks>

    <MediaFiles>

    <MediaFile delivery="progressive" type="video/mp4" width="1280" height="720">

    <![CDATA[https://YOUR_AD_VIDEO.mp4]]>

    </MediaFile>

    </MediaFiles>

    </Linear>

    </Creative>

    </Creatives>

    <Description>Longer description of ad</Description>

    </InLine>

    </Ad>

    </VAST>

    5.2 Macro Substitution

    Vungle Exchange supports a macro substitution for the auction price in the nurl field of the Bid object in the bid response. For example:

    "nurl": "http://bidder.com/won?price=${AUCTION_PRICE}"

    View Article
  • This article describes the Vungle process and specifications for helping a new VAST partner integrate their technology into our programmatic ad platform. For more information, please take a look at the IAB VAST 2.0 document.

    Contents

    VAST response specifications

    Vungle's partner integration protocol

    Sample VAST requests

    VAST request parameters

    VAST response specifications

    The bid response must adhere to the following specifications:

    Maximum 30-second video duration

    Minimum bitrate of 250 kbps

    XML must contain:

    one .mp4 media file

    bitrate information

    video length information

    Any redirects canonly redirect a maximum of one time

    Response time:

    for streaming: must be within 250ms

    for pre-cached: must be within 750ms

    Must click through to landing page

    Must support SSL and respond with secure assets

    Respond with no-ad or 403 in the event of a no ad

    VAST extensions are optional, but preferred

    Vungle returns an error if any of the above requirementsare not met.

    Vungle's partner integration protocol

    When Vungle helpsa new VAST partner integrate their technology into our programmatic ad platform, the process is divided into two phases. The first phase can be described as general validation: Vungleinspects the tag, ensuring that server calls are fired correctly and that values are correctly populated. The second phase involves rigorous testing, during which we searchfor discrepancies among a statistically significant set of impressions to ensure that Vungle's numbers align with the partner's.

    Phase 1

    Partner sends Vungle technical documents (if available).

    Partner sends Vungle a test VAST endpoint. Note:During the test phase, Partner must respond to 100% of Vungle's bid requests to generate significant test results.

    Vungle builds a test environment to call Partner'sendpoint on demand. This is used to validate variable values and tracking beacons.

    Phase 2

    Vungle works with Partner to set up test campaigns.

    Partner sends test endpoint simulatingreal demand.

    Vungle sets up a test campaign to run a predetermined number of impressions.

    Partner and Vungle reconcile delivery and compare discrepancy.

    If any issues with tracking, targeting, or discrepancy occur, Vungle and Partner work together to debug them until each issue is resolved.

    Sample VAST requests

    Sample VAST request URL (VAST tag) with unfilled parameters

    https://partner.com/vast2/6524rgww153hifw/?duration=15&app_name={{{pub_app_name}}}&app_id={{{market_id}}}&rtb_type=instream_mobile_vast_inter&user_id={{{device_id}}}&ua={{{browser_user_agent}}}&random={{{timestamp}}}&ip_address={{{ip}}}

    Sample VAST request URL (VAST tag) with filled parameters

    https://partner.com/vast2/124765432/?duration=15&app_name=My%20Talking%20Tom%20Free%20for%20Android&app_id=com.outfit7.mytalkingtomfree&rtb_type=instream_mobile_vast_inter&user_id=6df43c89-9e3d-43fb-a1e9-bacd51932d41&ua=Mozilla%2F5.0%20(Linux%3B%20Android%204.4.2%3B%20SPH-L720%20Build%2FKOT49H)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Version%2F4.0%20Chrome%2F30.0.0.0%20Mobile%20Safari%2F537.36&random=2015-01-27T21%3A30%3A34%2B00%3A00&ip_address=66.87.114.254

    VAST Request Parameters

    Parameter Name

    Macro

    Value

    Notes

    Example

    App Category

    {{{pub_app_store_category}}}

    String

    List of categories

    Games

    App Name

    {{{pub_app_name}}}

    String

    From the iTunes or Play store

    Family Farm Seaside

    App Store URL

    {{{pub_app_store_url}}}

    String

    App Store or content URL. Encoded.

    https://play.google.com/store/apps/details?id=com.funplus.familyfarm&hl=en

    Bundle ID

    {{{pub_market_app_id}}}

    String/Int

    From the iTunes or Play store

    com.funplus.familyfarm&hl=en (Android) 539920547 (iOS)

    City

    {{{city}}}

    String

    Encoded

    New York

    Connection Type

    {{{connection_type}}}

    String

    Wifi, wwan, mobile

    Wifi, wwan, mobile

    Country

    {{{country}}}

    String

    Two-letter country code

    US

    Device DNT

    {{{ad_tracking_disabled}}}

    String

    'True' indicates that user does not allow ad tracking

    True/False

    Device DNT

    {{{ad_tracking_enabled}}}

    String

    'True' indicates that user does allow ad tracking

    True/False

    Device DNT

    {{{boolean_number ad_tracking_disabled}}}

    Int

    Do not track, in binary form

    0 False 1 - True

    Device ID

    {{{device_id}}}

    String

    Clear or Hashed

    ab4d6cc4-f57f-4309-9d29-b7fb5e35dd74

    Device Model

    {{{device_model}}}

    String

    Encoded

    Amazon,KFFOWI samsung,SM-J700T

    IP

    {{{ip}}}

    String

    Internet Protocol Address

    95.118.153.77

    Language

    {{{language}}}

    String

    Two-character Language from headers

    10.2.1

    OS version

    {{{os_version}}}

    String

    OS Version (ie iOS 7.2)

    2014-12-05T00%3A44%3A19%2B00%3A00

    Platform

    {{{device_platform}}}

    String

    iOS or Android

    iOS/Android

    Screen Height

    {{{screen_height}}}

    Integer

    Screen height (pixels)

    768

    Screen Orientation

    {{{screen_orientation}}}

    String

    Portrait or Landscape

    Portrait/Landscape

    Screen Width

    {{{screen_width}}}

    Integer

    Screen width (pixels)

    1024

    Timestamp

    {{{timestamp}}}

    String/Int

    Encoded

    2014-12-05T00:44:19+00:00

    User Agent

    {{{browser_user_agent}}}

    String

    UA from headers. Encoded.

    Mozilla/5.0 (Linux; Android 5.1.1; VF-1397 Build/LMY47V; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/55.0.2883.91 Safari/537.36

    Vungle ID

    {{{vungle_id}}}

    String

    Vungle Publisher ID to associate performance

    5497c989a3b61ba3660001b1

    View Article
  • Why are there no impressions or clicks tracked on the Vungle Self-Serve Platform?

    This is unrelated to the click and impression trackers you have in place for your campaign. We will serve impressions and track clicks internally, regardless of the tracking links.

    If there are no impressions, its likely that the campaign setup has an issue. Make sure the targeting capability is set up properly, creatives are properly attached, and the campaign is set live. View more about campaign troubleshooting.

    If there are a low number of clicks even though there are impressions, there could be an issue with the creative performance. For example, is the creative localized for the specific country?

    Why are there no installs tracked on the Vungle Self-Serve Platform?

    If you believe that there are enough impressions & clicks to have an install, the first place to check is whether there are installs tracked on the MMP dashboard. If yes, then it may be the case the the install postbacks from the MMP to Vungle is not enabled or set up correctly. Make sure that its using the correct Vungle App ID. See our install postback setup article for complete guidelines.

    Why are there no installs tracked on the MMP dashboard?

    This means that the MMP was unable to track an install attributed to Vungle. Its possible that the tracking URLs were not properly set up to pass the information necessary for the MMP to attribute to the clicks. Does the click URL have superfluous characters that might break the URL? Is the device parameter specific to your MMP properly appended? Are you using the correct Vungle device ID macro? See our complete tracking URL macro list.

    View Article
  • Use the Advertiser Self-Serve Platform to add, edit, and manage your applications, campaigns, and creatives, as well as to view detailed campaign and creative reporting.

    Getting Started

    Go to https://vungle.com/login/

    Note

    Whether you are creating a new account or have an existing one will determine your user experience.

    Start by logging in. New users click Sign Up.

    After logging in, you can select the Language for your interface in the header. We offer English, Simplified Chinese, Japanese, and Korean.

    Existing users enter the email that serves as your username, and your password. New users enter your correct credentials. (Not sure if you have an account or if you forgot your password? Click here.) If you are managed by someone on our Vungle team, please contact your account manager for help.

    Click Login.

    Account Types: Pre-Pay vs Post-Pay

    There are two different account types: pre-pay or post-pay. The type of account you have is defined by your account manager when you work together during onboarding, or is defined when you first sign up on https://vungle.com/signup/

    If you have a pre-pay account, you can add funds by editing Available Funds and adding a payment option.

    Vungle VAST 2.0 Integration Guide

    If you have a post-pay account, work with your account manager to set up the budget. You won't be able to edit it from the Advertiser Self-Serve Platform.

    Account

    https://advertiser.vungle.com/account

    Using the account page, set up and edit your account with Vungle. The top of the My Account page show your current funds and spend.

    To edit your account in the My Account page:

    Navigate to the My Account page by clicking on the menu in the top right corner of the platform and selecting My Account.

    Make sure to have all your account details filled, then click Save.

    If you have a pre-pay account, edit your Available Funds. Enter your payment information and click Process Payment.

    Applications

    https://advertiser.vungle.com/applications

    Existing Users

    Search for the app you want to edit by name, or filter your apps by platform to narrow your search. On each application card, use the total campaigns & total creatives quick-links to view more in-depth information about your application.

    New Users

    Begin by adding your application to your account.

    Click Add Application and select its operating system. We support iOS, Android, Amazon and Windows. Based on the platform, you will need to provide specific criteria to locate your live application in the particular store.

    Click Save.

    All subsequent screens are now more granular; you will be entering information at the campaign and creative levels going forward.

    Note

    You cannot change the platform later

    Campaigns

    https://advertiser.vungle.com/campaigns

    The group of Campaigns pages guide you through all the settings that define a campaign. These pages include Tracking, Targeting, Bidding, and Creatives. You fill them out when adding a new campaign or when editing an existing campaign. You can click Review from any page in the campaign flow as you work.

    Existing Users

    The main Campaigns page lists all your campaigns, their active dates, budgets, bids, and campaign types. You can learn the status of each campaign on this page as well: campaigns can be Active (serving ads), Pending (under Vungle review), or Paused (not serving ads).

    When you open an existing campaign, the left panel displays checkmarks next to settings that are complete and blank circles next to those that you must still fill in.

    Hovering over a campaign name displays details about its status. If the campaign is Not Serving ads, you can view the reason(s) to later fix them.

    Clicking on a campaign takes you to edit pages where you can change the campaigns settings.

    New Users

    You can navigate to your desired campaign in several ways:

    You can start at the Applications page, select the app to which your campaign belongs, and then select the campaign.

    You can start right at the Campaigns page, which lists all your campaigns regardless of app. To find your campaign, you can search by typing its name or filtering on attributes such as applications, platform, status, start and end dates, and bid types.You can also add a new campaign from this screen by clicking Add Campaign. A new page then lets you either select the app to which the campaign will belong, or add a new app altogether.

    If you are defining a new app, the Platform guides you to the Campaigns page to create a campaign for your new app.

    Tracking

    While setting up a campaign, you will need to provide MMP URLs to properly configure attribution. In the Tracking section of the Campaign builder, you will be able to edit these options.

    Select your appropriate network for your campaign.

    Based on the MMP provider, you will be asked to provide unique information related to your application (you can reach out to your tracking provider for more information). Enter the tracking URL you use to receive TPATs for click events, then add additional customizations. If you have a dedicated Vungle Account Manager, feel free to reach out to them for help.

    For view-through or impression tracking, select each event you want tracked in the Impressions and Events section, then enter the tracking URL for that event. You can choose from Creative Start (when 0% of the video has been viewed), 1st Quartile (when 25% of the video has been viewed), Midpoint (when 50% of the video has been viewed), 3rd Quartile (when 75% of the video has played), and additional options.

    Targeting

    Set up or edit your campaign targeting in this page. You can target countries, device types, connection types, and OS versions. You can also whitelist or blacklist select Publishers.

    Note

    Limiting your targeting options severely reduces your available impressions.

    We offer several targeting options.

    For Operating System, enter a range of release versions to target.

    To whitelist or blacklist one or more Publishers, enter the Publisher IDs separated by commas, spaces, or newlines. You can find Publisher IDs in the Platform Reporting section, or by using the Advertising Reporting API.

    Because whitelisting and blacklisting can have a serious impact on your campaign, we recommend that you first run a campaign without either.

    Bidding

    Use the bidding page to set up or edit how your campaign operates.

    Enter the Bid Amount.

    Enter a Daily Budget for the campaign to set the maximum spend per day. Note that a Daily Budget is effectively a target, due to delays in conversion.

    Enter a Total Budget to set the maximum spend target for the entire campaign. The campaign will pause once the budget is exhausted.

    For campaigns that are already running, youll be able to use our Multi-Bidding feature

    Learn How to Use Our Multi-bidding Feature

    Creatives

    Note

    If you are in the campaign builder, you will most likely be adding new creatives. If you are looking through your existing creatives, your creative experience will be a little different.

    Existing Users

    The main Creatives page displays all the creatives you have defined so far. You can learn the status of each creative on this page as well; creatives can be Active (serving ads), Pending (under Vungle review), or Paused (not serving ads). If the creative is Not Serving ads, you can view the reason(s) to fix them later.

    New Users

    No creatives? Good news! We offer you the ability to create them using our builder.

    The Creatives page is divided into panels to seamlessly create creatives to serve on our network.

    The bottom left panel displays various creative assets you have uploaded; these include videos and images.

    Drop the assets you want to use for a specific creative into the top left panel.

    The upper right panel is devoted to templates. Which templates are enabled depends on which assets you have dropped into the top left panel. Hover over a template to find out which assets it requires. Selecting a template completes the construction of your creative.

    You can now attach it to your campaign in the lower right panel.

    Reports

    https://advertiser.vungle.com/reports

    Use the Reports pages to examine the performance of your campaigns and creatives. The main Reports page displays your total impressions, clicks, installs, and spend for the last seven days. Beneath it is a list of your apps and campaigns.

    Above the metrics, you can select whether to view data for either campaigns or creatives. You can then view data for all your campaigns or creatives, or find a specific campaign or creative using the Search box. Select a date range and up to two metrics for your report.

    Additional Reading

    For more Advertiser Self-Serve information, please refer to:

    Multi-bidding

    Reporting API 2.0 for Advertisers

    Install Postback API Documentation

    Post-Install Postback API Documentation

    Integrating Vungle with TPAT

    Tracking URL Macros

    Vungle OpenRTB 2.3 Integration Guide

    View Article
  • Multi-bidding lets advertisers set how muchthey'rewilling to bid by publisher, by any publisher/country combination, or set country-level default bids. Multiple custom bids can be uploaded simultaneously through a single CSV file. Edit existing bids, create new ones, or remove publisher or country bids. With full bidding granularity, you can bid smarter for higher ROAS, using fewer campaigns.

    Log into your advertiser self-serve platform.

    Select any campaign and go to its Bidding section.

    Click on Download CSV Example.

    Update the CSV with any of the following combinations: publisher app ID and bid rate publisher app ID, country (geo), and bid rate geo and bid rate use an asterisk (*) in the publisher app ID column to set this as the country default bid.

    Save your CSV file.

    Click Upload CSV File. Select your new CSV file.

    Click on the pencil icon next to Multi-bidding to make edits.

    Click on any bid to edit it. After making an edit, scroll to the bottom of the window and clickLooks Good. Then clickReview to review your campaign summary, or clickContinue.

    ClickSave & Activateto activate the campaign.

    Notes

    File must be in .csv format.

    Vungle Publisher App ID must be correct name does not.

    Campaigns support up to 10,000 publisher bids at a time.

    Publishers can only be added or removed through CSV upload.

    Sorry, Safari is not supported at this time.

    View Article
  • Adding new users to an Advertiser account

    Click themenu in the upper right of the dashboard.

    SelectMy Team.

    ClickAdd Team Member.

    Fill in the new members details.

    Select anAll AccessorRead-only Accesslevel for the new member.

    ClickInvite.

    Editing users

    Click themenu in the upper right of the dashboard.

    SelectMy Team.

    Click onabove the team member you want to edit.

    ClickEdit.

    Make your changes and clickSave.

    Deleting users

    Click themenu in the upper right of the dashboard.

    SelectMy Team.

    Click onabove the team member you want to delete.

    ClickDelete.

    View Article
  • For our self-serve customers who do not have a dedicated Account Manager, we require a $5,000 minimum prepayment.

    Please see below for frequently asked questions regarding payment:

    Why was my campaign paused?

    Its possible that the remaining budget has fallen below 5%. Campaigns will be paused to avoid over-delivering impressions to your campaigns. To reactivate your campaign, please add additional funds to your account.

    Is it possible to prepay an amount lower than $5,000?

    Unfortunately, we cannot currently accommodate lower prepay amounts. However, we will refund any unused budget.

    Idon'tplan on running campaigns with Vungle anymore. How do I get refunded for an unused budget?

    Refunds

    Please e-mail [email protected] and include your Account Name to let us know that you would like to get refunded. Our Accounting Team will refund all remaining funds.

    View Article
  • Why is my campaign not seeing any spend, impressions, or clicks?

    Check that funds have been deposited in your account.

    Verify that the campaign(s) are set to active.

    Verify the campaign start and end dates:

    Confirm that the campaign start date is not set for a future date.

    Confirm the campaign end date.

    Verify that creatives are uploaded, active, and enabled.

    Verify that the app ID is correct in the MMP dashboard.

    Verify that the tracking links and/or app store destination URL are set up properly

    Refer to the following link for tracking link setup.

    Verify that OS targeting is set up appropriately and the appropriate country codes are targeted.

    Questions

    For any other inquiries/questions, please reach out to [email protected]

    View Article
  • Use this guide to quickly integrate our SDK into your app and start monetizing.

    The code samples in this guide are in C#, but we provide sample app files in C#, C++, Visual Basic, and DirectX+XAML from our GitHub repository.

    Contents

    Before You Get Started

    Download the SDK andAdd Vungle SDK to Your Project

    Option 1. NuGet Integration

    Option 2. Manual Integration

    internetClient Capability

    Visual Studio

    Manual Edit

    Import the VungleSDK Namespace

    Obtain a VungleAd Instance

    (Optional)New Configuration Settings

    Create and Register an Event Handler

    Load an Ad for a Placement

    Play an Ad for a Placement

    Customization Options

    Showing the Close Button

    GDPR Recommended Implementation Instructions

    Subscribing to Event Handlers

    UI Thread Note

    VungleAd Event Handlers

    Playing Native Flex Ads

    Requirements for Native Flex Ads

    UI Setup for Native Flex Ads - XAML

    Load a Native Flex Ad

    Play a Native Flex Ad

    Close a Native Flex Ad

    Event Handers for Native Flex Ads

    Before You Get Started

    This guide is for Vungle Windows SDK 5.3.2 and higher. The integration guide for Vungle Windows SDK version 1.3.16 and below is here: Get Started with Vungle - Windows SDK v. 1.0 - v.1.3.16.

    Vungle Windows SDK v. 1.3.16 through the current version are all compatible withWindows 10 October 2018 Update (Redstone 5).

    The integration requires a Vungle account, so create a Vungle account if you havent already.

    If you haven't already done so, head over to our dashboard and add your app to your account. Please check Setting Up and Reporting on Placements to learn how to set up placements in the Vungle dashboard.

    You must use Visual Studio 2015 if you are developing for Windows 8.1 and Windows Phone 8.1 because Visual Studio 2017 stopped supporting these versions.

    The Back button is supported on mobiles, but not on PCs (keyboard). This can result in different behavior and user experience for UWP builds.

    Please switch your application to Active mode if no ads are being returned in Test mode.

    Download the SDK and Add Vungle SDK to Your Project

    There are two ways to add Vungle to your Visual Studio project: using NuGet or manual integration.

    Option 1. NuGet Integration

    In Visual Studio, right-click on yourProject's name in the Solution Explorer and select Manage NuGet Packages.

    Click Browse, enter Vungle, select Vungle SDK.

    Click Install.

    Option 2. Manual Integration

    Download the Vungle Windows SDK from the Vungle Dashboard.

    Extract the archive.

    In Visual Studio, create a new project using the right template for your application and programming language.

    Add a reference for your project to the Vungle Windows SDK file that you downloaded.

    Vungle SDK has two VungleSDK.windmd files: for Windows 10 or 8.1 development. Use the correct SDK from the extracted directory, Win10 or Win81.

    internetClient Capability

    Make sure that your project has the internetClient capability in the package.appxmanifest file.

    Visual Studio

    Double-click appxmanifest in Solution Explorer.

    Select the Capabilities

    Confirm that the Internet (Client) option is checked.

    Manual Edit

    Open the package.appxmanifeset file and add internetClient to Capabilities section.

    <Capabilities> ... <Capability Name="internetClient" /> ...</Capabilities>

    Import the VungleSDK Namespace

    using VungleSDK;

    Obtain a VungleAd Instance

    Starting with v6.3.0, VungleAd instance takes your Vungle app ID only.

    VungleAd sdkInstance;

    string appID = app_id;

    sdkInstance = AdFactory.GetInstance(appID);

    In the above example, replace appId with your Vungle app ID. We recommend that you follow these initialization steps as soon as your app finishes loading critical components so that cache optimization can start.

    For v6.2.0 and below,VungleAd instance takes two parameters: a string for your Vungle app ID and an array of strings for placement IDs. You can only use placement IDs that you have already included when you are obtaining the instance.

    sdkInstance = AdFactory.GetInstance(appID, placementList);

    (Optional)New Configuration Settings

    Create a VungleSDKConfig object and add it as a parameter in SDK initialization to specify optional configuration settings.

    VungleSDKConfig sdkConfig = new VungleSDKConfig();

    sdkInstance = AdFactory.GetInstance(appID, sdkConfig);

    VungleSDKConfig contains parameters that allow you to limit Windows ASHWID tracking and set the minimum disk space required to initialize or load ads.

    sdkConfig.DisableAshwidTracking = true;

    sdkConfig.MinimumDiskSpaceForAd = 50 * 1024 * 1024;

    sdkConfig.MinimumDiskSpaceForInit = 50 * 1024 * 1024;

    Create and Register an Event Handler

    Create an event handler for OnAdPlayableChanged event. This event handler is called when the ad availability state changes. You can identify which placement triggered the event by checking e.Placement.

    // Event handler for OnAdPlayableChanged event

    private async void SdkInstance_OnAdPlayableChanged(object sender, AdPlayableEventArgs e)

    { if (e.AdPlayable == true) {

    // e.Placement - placement ID in string

    // Run asynchronously on the UI thread

    await CoreApplication.MainView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,

    new DispatchedHandler(() => methodToRun(e.Placement))); }

    }

    Register this event handler for OnAdPlayableChanged event.

    sdkInstance.OnAdPlayableChanged += SdkInstance_OnAdPlayableChanged;

    Load an Ad for a Placement

    To load an ad, callLoadAd andallow enough time to download ad assets, and then wait forOnAdPlayableChangedto be called:

    sdkInstance.LoadAd(placement_id);

    Note: Placement IDs are case-sensitive.

    Sample code:

    private void OnLevelStart(Object sender, RoutedEventArgs e)

    {

    sdkInstance.LoadAd(placement_id);

    }

    Play an Ad

    Play an ad with the default configuration:

    sdkInstance.PlayAdAsync(new AdConfig(), placement_id);

    Sample code:

    private async void OnLevelComplete(Object sender, RoutedEventArgs e)

    {

    await sdkInstance.PlayAdAsync(new AdConfig(), placement_id);

    }

    You can optionally customize the ads you play by providing options to AdConfig object.

    Sample code:

    private async void PlayCustomizedAd(Object sender, RoutedEventArgs e)

    {

    AdConfig adConfig = new AdConfig();

    adConfig.Orientation = DisplayOrientations.Portrait;

    adConfig.SoundEnabled = false;

    await sdkInstance.PlayAdAsync(adConfig, placement2);

    }

    Customization Options

    These are the available properties in the AdConfig object instance:

    Note:Rewardedads are in some cases referred to asincentivizedads; both terms always refer to the same kind of ad. In the SDK code and in our Reporting API, we use the term 'incentivized'.

    Options

    Default Value/Type

    Description

    Orientation

    AutoRotate

    DisplayOrientations

    Orientation.AutoRotate (default) makes the ad autorotate with the device orientation.

    Orientation.Portrait makes the ad play only in the portrait orientation.

    Orientation.Landscape makes the ad play only in the landscape orientation.

    Note: This option only applies to mobile applications.

    SoundEnabled

    true

    bool

    Sets the starting sound state for the ad.

    If true (default), the audio respects device volume and sound settings.

    If false, video begins muted but user may modify.

    BackButtonImmediatelyEnabled

    false

    bool

    If true, allows the user to immediately exit an ad using the back button.

    If false (default), the user cannot use the back button to exit the ad until the on-screen close button is shown.

    Note: This option only applies to mobile applications.

    UserId

    null

    string

    Passes the unique user ID to your application to verify that this user should be rewarded for watching an incentivized ad when server-to-server callback is used for verification.

    Note: This setting is applicable only for rewarded placements.

    IncentivizedDialogTitle

    Close this ad?

    string

    Sets the title of the confirmation dialog when skipping an incentivized ad.

    Note: This setting is applicable only for rewarded placements.

    IncentivizedDialogBody

    Are you sure you want to skip this ad? You must finish watching to claim your reward.

    string

    Sets the body of the confirmation dialog when skipping an incentivized ad.

    Note: This setting is applicable only for rewarded placements.

    IncentivizedDialogCloseButton

    "Close"

    string

    Sets the 'cancel' button text of the confirmation dialog when skipping an incentivized ad.

    Note: This setting is applicable only for rewarded placements.

    IncentivizedDialogContinueButton

    "Continue"

    string

    Sets the 'keep watching' button text of the confirmation dialog when skipping an incentivized ad.

    Note: This setting is not applicable if the ad is not incentivized.

    Volume

    1.0

    double

    This setting represents a fraction of the device volume and accepts values between 0.0 and 1.0.

    Note: This setting is only available for v6.3.0 and above.

    Incentivized

    -

    DEPRECATED

    You can set the rewarded configuration at the placement level from the dashboard. Refer to Setting Up and Reporting on Placements.

    Note: The options for SoundEnabled and incentivized dialogs for Dynamic Template and Flex View ads are available on the dashboard to configure. Programmatic configuration will only apply to legacy ads.

    Showing the Close Button

    To control whether a user has the option to close out of an ad, use the forced view options in your app's advanced settings on the Vungle Dashboard.

    GDPR Recommended Implementation Instructions

    As of May 25th, the General Data Protection Regulation (GDPR) will be enforced in the European Union. To comply with GDPR, developers have two options.

    Option 1 (recommended): Publisher controls the GDPR consent process at the user level, then communicates the users choice to Vungle. To do this, developers can collect the users consent using their own mechanism, and then use Vungle APIs to update or query the users consent status.

    Option 2: Allow Vungle to handle the requirements. Vungle will display a consent dialog before playing an ad for a European user, and will remember the users consent or rejection for subsequent ads.

    // To set the users consent status as opted in to version 1.0 of your consent dialog:sdkInstance.UpdateConsentStatus(VungleConsentStatus.VungleConsentAccepted,"1.0");// To set the users consent status as opted out of version 2.0 of your consent dialog:sdkInstance.UpdateConsentStatus(VungleConsentStatus.VungleConsentDenied,"2.0");

    // To find out what the users current consent status is:

    // This will return null if the GDPR Consent status has not been set

    // Otherwise, it will return VungleConsentStatus.VungleConsentAccepted or

    // VungleConsentStatus.VungleConsentDenied

    UpdateConsentStatus? currentStatus = sdkInstance.GetCurrentConsentStatus();// To find out which version of your consent dialog the user was last shown:sdkInstance.GetConsentMessageVersion();

    If you are using 6.2 or below, please set the consent status as follows:

    // To set the users consent status on SDK versions 6.2 and below:sdkInstance.UpdateConsentStatus(VungleConsentStatus.VungleConsentAccepted);

    Subscribing to Event Handlers

    The Windows SDK raises several events that you can handle programmatically. You can use these event handlers to control features of your app, such as pause/resume of background music.

    UI Thread Note

    The event listeners are executed on a background thread, so any UI interaction or updates resulting from an event listener must be passed to the main UI thread before executing. Here is one way to do it:

    await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, new DispatchedHandler(() => {

    // This block will be executed in the UI thread }

    );

    VungleAd Event Handlers

    Event Handlers

    Description

    OnInitCompleted

    Called immediately after initialization of the SDK has completed. You can check whether there is an ad downloaded from a previous session, or load an ad for placements.

    OnAdPlayableChanged

    Notifies about change of ad availability for the placement. Wait for this event handler to perform an action when an ad becomes available after loading an ad for placement.

    OnAdStart

    Called before playing an ad. You can perform actions such as pausing background music.

    OnAdEnd

    Called when the user closes the end card and control is returned to your application. If either IsCompletedView or CallToActionClicked is true, the user watched the ad or clicked the download button in the ad. In this case, if it was a rewarded ad, the user should be rewarded. You can perform actions such as resuming app features.

    Diagnostic

    Called when the SDK wants to print diagnostic logs.

    Sample code:

    //Register event handlers

    sdkInstance.OnInitCompleted += SdkInstance_OnInitCompleted;

    sdkInstance.OnAdPlayableChanged += SdkInstance_OnAdPlayableChanged;

    sdkInstance.OnAdStart += SdkInstance_OnAdStart;

    sdkInstance.OnAdEnd += SdkInstance_OnAdEnd;

    sdkInstance.Diagnostic += SdkInstance_Diagnostic;

    ...

    // OnInitCompleted

    // e.Initialized - true if initialization succeeded, false if failed

    // e.ErrorMessage - reason for failure when e.Initialized is false

    private async void SdkInstance_OnInitCompleted(object sender, ConfigEventArgs e)

    {

    var placementsInfo = "OnInitCompleted: " + e.Initialized;

    // Initilization was success

    if (e.Initialized == true)

    {

    // Print out list of placements

    for (var i = 0; i < e.Placements.Length; i++)

    {

    placementsInfo += "\n\tPlacement" + (i + 1) + ": " + e.Placements[i].ReferenceId;

    if (e.Placements[i].IsAutoCached == true)

    placementsInfo += " (Auto-Cached)";

    }

    }

    // Initilization failed

    else

    {

    placementsInfo += "\n\t" + e.ErrorMessage;

    }

    System.Diagnostics.Debug.WriteLine(placementsInfo);

    await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, new DispatchedHandler(() =>

    NotifyInitialization(e.Initialized)));

    }

    // OnAdPlayableAdPlayable

    // e.AdPlayable - true if an ad is available to play, false otherwise

    // e.Placement - placement ID in string

    private async void SdkInstance_OnAdPlayableChanged(object sender, AdPlayableEventArgs e)

    {

    System.Diagnostics.Debug.WriteLine("OnAdPlayable(" + e.Placement + ") - " + e.AdPlayable);

    await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, new DispatchedHandler(() =>

    NotifyWatcher(e.AdPlayable, e.Placement)));

    }

    // OnAdStart

    // e.Id - Vungle app ID in string

    // e.Placement - placement ID in string

    private void SdkInstance_OnAdStart(object sender, AdEventArgs e)

    {

    System.Diagnostics.Debug.WriteLine("OnAdStart(" + e.Id + "): " + e.Placement);

    }

    // OnAdEnd

    // e.Id - Vungle app ID in string

    // e.Placement - placement ID in string

    // e.IsCompletedView- true when 80% or more of the video was watched

    // e.CallToActionClicked - true when the user has clicked download button on end card

    // e.WatchedDuration - DEPRECATED

    private void SdkInstance_OnAdEnd(object sender, AdEndEventArgs e)

    {

    System.Diagnostics.Debug.WriteLine("OnVideoEnd(" + e.Id + "): "

    + "\n\tPlacement: " + e.Placement

    + "\n\tIsCompletedView: " + e.IsCompletedView

    + "\n\tCallToActionClicked: " + e.CallToActionClicked

    + "\n\tWatchedDuration: " + e.WatchedDuration);

    }

    // Event handler called when SDK wants to print diagnostic logs

    private void SdkInstance_Diagnostic(object sender, DiagnosticLogEvent e)

    {

    System.Diagnostics.Debug.WriteLine("Diagnostic - " + e.Level + " " + e.Type + " " + e.Exception + " " + e.Message);

    }

    // DEPRECATED - Use SdkInstance_OnAdEnd() instead private void SdkInstance_OnVideoView(object sender, AdViewEventArgs e) { }

    Playing Native Flex Ads

    Vungle Windows SDK 5.1.0+ supports our new Native Flex ad feature.VungleAdControl achieves video ads in native formats by passing a custom container to the Vungle SDK through the AdConfig.AdContainer property and managing the content of Container.Content of the host app.

    Requirements for Native Flex Ads

    Windows SDK 5.1.0+

    Windows 10 UWP

    Please consult your account manager or contact [email protected] to configure Native Flex Ad placements.

    UI Setup for Native Flex Ads - XAML

    VungleAdControl must be declared with the Vungle app ID, all of the placement IDs used in the app, and the placement ID for the particular Native Flex view or feed placement. You can also set theUserId that is used for rewarded placements here.

    Sample code:

    <Grid <UI:VungleAdControl x:Name="vungleEmbedded" Height="200" Width="300"AppID="vungle_app_id"Placements="placement_id_1,placement_id_2,native_flex_id"Placement = "native_flex_id"UserId="vungle_test_user"><TextBlock x:Name="Vungle Native Flex Ad"/></UI:VungleAdControl></Grid>

    Load a Native Flex Ad

    Loading an ad using Native Flex placement is identical to loading a full-screen ad.

    Sample code:

    sdkInstance.LoadAd(native_flex_id);

    Play a Native Flex Ad

    Playing an ad using Native Flex placement is similar to playing a full-screen ads, but any customization must be configured in .xaml or on the Dashboard, including starting the ad with sound disabled.

    Sample code:

    await vungleEmbedded.PlayAdAsync();

    Close a Native Flex Ad

    Due to the nature of Native Flex ads, a user can stop viewing the video without closing the ad. You must therefore tell the SDK to dismiss the ad when it is no longer on screen. To do this,we have introduced two methods to close a Native Flex ad:

    Use CloseFlexViewAd(String placementId) to immediately close the ad with the given placement ID.

    Use SetFlexViewCloseTimeInSec(String placementId, int seconds) to close the given placement after the specified number of seconds has elapsed.

    Event Handlers for Native Flex Ads

    Consider registering separate event handlers to manage the different behaviors of full-screen and native ads for a smoother user experience.

    Sample code:

    vungleEmbedded.OnAdStart += (sender, arg) => {

    ...

    }

    vungleEmbedded.OnAdEnd += (sender, arg) => {

    ...

    }

    await vungleEmbedded.PlayAdAsync();

    View Article
  • This guide is a superset ofall the important information you need to integrate Vungle rewarded video usingFyber mediation.

    For generalintegration,start here: https://developer.fyber.com/

    iOS

    Getting started with Fyber iOS integration: https://dev-ios.fyber.com/docs

    Integration Guide for Vungle through Fyber mediation on iOS: https://fyber-mediation.fyber.com/docs/vungle

    Android

    Getting started with Fyber Android integration: https://dev-android.fyber.com/docs

    Integration Guide for Vungle through Fyber mediation on Android: https://fyber-mediation.fyber.com/docs/vungle

    Unity

    Getting started with Fyber Unity integration: https://dev-unity.fyber.com/docs

    Integration Guide for Vungle through Fyber mediation on Unity: https://fyber-mediation.fyber.com/docs/vungle

    View Article
  • Use this guide to add VungleAndroid SDK into yourapp, usingMoPub as yourmain advertising mediation layer. MoPub Android adapter 6.4.11 is compatible with Vungle Android SDK 6.4.11.

    Download Vungle Android SDK 6.4.11

    Download MoPub Android Adapter 6.4.11

    Contents

    Before You Begin

    Step 1. Set Up Vungle as a Network

    Set Up Vungle as an SDK Network

    Set Up Vungle as a Custom Native Network

    Step 2. Add Vungle as a Third-Party Ad Network

    Optional Advanced Settings

    Early SDK Initialization

    Memory Settings

    Restrict usage of device ID

    Interstitial Ads

    Rewarded Ads

    Additional Note

    Before You Begin

    The Vungle Android SDK 6.4.11 has been tested with MoPub Android SDK 5.7.1.

    The MoPub Dashboard does not yet include Vungle placements. You can check placement level performance using our Reporting API for Publishers.

    MoPub must be set up in your app before starting this tutorial. For a step-by-step guide, refer to MoPubs Getting Started Guide for Android.

    You will need the Vungles App ID and all the placement reference IDs you want to use in your app. You can find these IDs in the Vungle Dashboard (refer to Setting Up and Reporting on Placements ).

    Interstitial: https://developers.mopub.com/publishers/android/interstitial/

    Rewarded Video: https://developers.mopub.com/publishers/android/rewarded-video/

    MREC (300 x 250): https://developers.mopub.com/publishers/android/banner/

    Vungle SDK requiresAndroid OS 4.0 (Ice Cream Sandwich - API version 14) and up

    Step 1. Set Up Vungle as an SDK Network or as a Custom Native Network

    Set Up Vungle as an SDK Network

    Log in to the MoPub dashboard and select Networks from the main navigation panel.

    Click New Network. Hardware acceleration and select Vungle.

    In the Network Settings section, if you Enable reporting access, enter your Reporting API Key from the Vungle Dashboard.

    In App & Ad Unit Setup, enter the Vungle Application ID and Placement Reference IDs.

    Set Up Vungle as a Custom Native Network

    To ensure that the MoPub servers recognize the integrated Vungle Adapters, set up Vungle as a Custom Native Network in the MoPub dashboard.

    Log into the MoPub dashboard, and select Networks from the main navigation bar.

    Click New network button on the top right. and select Vungle from the list.

    After creating Vungle as a Network, click on the name from the list of Networks. In the Set Up Your Inventory section, for each ad unit that will use the Vungle SDK to present video ads, ensure that the MoPub SDK can find the network adapter used to interact with the Vungle SDK:

    If you are using Rewarded Video for an ad unit, add com.mopub.mobileads.VungleRewardedVideo under the Custom Event Class section.

    If you are using Fullscreen (320 x 480) for an ad unit, add com.mopub.mobileads.VungleInterstitial under the Custom Event Class section.

    If you are using Medium (300 x 250) for an ad unit, add com.mopub.mobileads.VungleBanner under the Custom Event Class section.

    Add your Vungle App ID, placement reference ID of the placement to be called from the ad unit, and all placementreference IDsthat will be used in the app in JSON format under the Custom Event Class Data.

    Set the placement Reference ID you want to link to the MoPub Ad Unit for pid. Note: A default placement is created for each app automatically. You must provide its placement reference ID in this initialization step whether or not you plan to take advantage of the placements' functionality. If you create multiple placements, provide all the reference IDs.

    Make sure to link a placement that is set to rewarded type at Vungle dashboard to the MoPub Ad Unit that is set to Rewarded Video; and link a placement that is set to interstitial type at Vungle dashboard to the MoPub Ad Unit that is set to Fullscreen (320 x 480).

    {

    "appId":"5935efecc802d63d5100000f",

    "pid":"DEFAULT05223"

    }

    Note: The Vungle SDK will cache an ad automatically for the placement you selected to be Auto Cached in the Vungle Dashboard. We highly recommend selecting the MoPub Ad Unit shown first or the Ad Unit shown most frequently as the Auto Cached placement.

    Step 2. Add Vungle as a Third-Party Ad Network

    To add the Vungle Android SDK into your app using MoPub mediation:

    Add all the Vungle-related adapter files to the /src/main/java/com/mopub/mobileads/ directory in your apps project. This step is necessary because the MoPub SDK references these files as Custom Event Class properties in the directory.

    VungleAdapterConfiguration.java

    VungleBanner.java

    VungleInterstitial.java

    VungleNetworkSettings.java

    VungleRewardedVideo.java

    VungleRouter.java

    VungleRouterListener.java

    Follow the instructions in the Step 1. Include the Vungle SDK in Your Project section of Get Started with Vungle - Android SDK to add the necessary frameworks.

    If you need to set Multidex, Proguard and Google Play Services, follow the instructions in the Advanced Settings section of Get Started with Vungle - Android SDK toupdate AndroidManifest.xml in your project.

    Call the MoPubInterstitials show method (or, for rewarded ads, call the MoPubRewardedVideos's showRewardedVideo method) when you want to present a Vungle video ad. (No need to call the Vungle Android SDK methods directly. The MoPub SDK will do it.)

    Optional Advanced Settings

    Early SDK Initialization (Recommended)

    MoPub Android SDK 5.5.0 and above allows you to early initialize ad network SDK when MoPub SDK completes initialization. We strongly recommend you to use this feature as it will allow additional time for Vungle SDK to pre-cache an ad and have it ready to play at display opportunity.

    Sample code:

    SharedPreferences mPreferences = PreferenceManager.getDefaultSharedPreferences(this);

    Map<String, String> vungleSettings = new HashMap<>();

    vungleSettings.put("appId", "YOUR_VUNGLE_APP_ID");

    SdkConfiguration configBuilder = new SdkConfiguration.Builder("MOPUB_AD_UNIT_WITH_VUNGLE_PLACEMENT")

    .withMediatedNetworkConfiguration(VungleAdapterConfiguration.class.getName(), vungleSettings)

    .build();

    MoPub.initializeSdk(this, configBuilder, initSdkListener());

    Memory Settings

    Starting from v6.4.0, you can prevent the SDK from downloading, requesting ads or even initializing if the storage of your Android device falls below a predefined threshold.

    These are the option keys available:

    Keys

    Type/Value

    Description

    pre_key_min_space_for_init

    String, value in bytes (default 51 MB)

    Sets the required minimum available free storage space to be able to initialize the SDK

    pre_key_min_space_for_ad

    String, value in bytes (default 50 MB)

    Sets the required minimum available free storage space to be able to request an ad

    Sample code:

    Map<String, String> vungleSettings = new HashMap<>();

    vungleSettings.put("appId", "YOUR_VUNGLE_APP_ID");

    vungleSettings.put("VNG_MIN_SPACE_INIT",

    mPreferences.getString("pref_key_min_space_for_init", String.valueOf(20 * 1024 * 1024)));

    vungleSettings.put("VNG_MIN_SPACE_LOAD_AD",

    mPreferences.getString("pref_key_min_space_for_ad", String.valueOf(20 * 1024 * 1024)));

    Restrict usage of device ID

    For SDK version 6.4.10 onwards, publishers can now restrict from passing Android ID from the device to the SDK.

    Map<String, String> vungleSettings = new HashMap<>();

    vungleSettings.put("appId", "YOUR_VUNGLE_APP_ID");

    vungleSettings.put("VNG_DEVICE_ID_OPT_OUT",

    String.valueOf(mPreferences.getBoolean("pref_key_key_android_id_opted_out", true)));

    Interstitial Ads

    Attribute

    Default Value

    Description

    SOUND_ENABLED_KEY

    true

    Play ad with sound muted or unmuted. Set to 'false' to play muted. Set to 'true' to play with sound.

    ORDINAL_VIEW_COUNT_KEY

    null

    If you receive ordinal data reports from Vungle, use this field to pass the mediation ordinal. This is an integer indicating the order in which this ad was shown in the game session (for example, if two ads were already shown in this session, and this ad from Vungle was then shown third, pass in '3'). Read more about ordinal data here.

    AUTO_ROTATE_ENABLED

    false

    Set to true if the video ad is supposed to auto-rotate, false to follow video ad orientation

    Example

    HashMap<String, Object> extras = new HashMap<>();

    extras.put(VungleInterstitial.SOUND_ENABLED_KEY, false);

    extras.put(VungleInterstitial.ORDINAL_VIEW_COUNT_KEY, 1);

    extras.put(VungleInterstitial.AUTO_ROTATE_ENABLED, true);

    mMoPubInterstitial.setLocalExtras(extras);

    mMoPubInterstitial.load();

    Rewarded Ads

    Attribute

    Default Value

    Description

    withUserId

    null

    Sets the unique user ID to pass to your application to verify that this user should be rewarded for watching an incentivized ad.

    withCancelDialogBody

    "Closing this video early will prevent you from earning your reward. Are you sure?"

    Sets the body of the confirmation dialog when skipping an incentivized ad.

    withCancelDialogCloseButton

    Close Video

    Sets the 'cancel button' text of the confirmation dialog when skipping an incentivized ad.

    withCancelDialogKeepWatchingButton

    Keep Watching

    Sets the 'keep watching button' text of the confirmation dialog when skipping an incentivized ad.

    withCancelDialogTitle

    Close Video?

    Sets the title of the confirmation dialog when skipping an incentivized ad.

    withSoundEnabled

    true

    Sets the starting sound state for the ad. If 'true', the audio respects device volume and sound settings. If 'false', video begins muted but user may modify.

    withOrdinalViewCount

    null

    If you receive ordinal data reports from Vungle, use this field to pass the mediation ordinal. This is an integer indicating the order in which this ad was shown in the game session (for example, if two ads were already shown in this session, and this ad from Vungle was then shown third, pass in '3'). Read more about ordinal data here.

    withAutoRotate

    false

    Set to true if the video ad is supposed to auto-rotate, false to follow video ad orientation

    Example

    VungleRewardedVideo.VungleMediationSettings vungleSettings = new VungleRewardedVideo.VungleMediationSettings.Builder()

    .withUserId("VUNGLE_USER_ID")

    .withCancelDialogBody("CUSTOM_BODY")

    .withCancelDialogCloseButton("CUSTOM_CLOSE")

    .withCancelDialogKeepWatchingButton("CUSTOM_KEEPWATCHING")

    .withCancelDialogTitle("CUSTOM_TITLE")

    .withSoundEnabled(true)

    .withOrdinalViewCount(10)

    .withAutoRotate(true)

    .build();

    MoPubRewardedVideos.loadRewardedVideo(mAdUnitId, vungleSettings);

    Additional Note

    Android SDK - Hardware Acceleration

    is enabled by default if your target API level is set to 14 or above. This option must be enabled for the SDK to properly show Dynamic Template ads. Please make sure your project does not have this option set to false.

    < application android:hardwareAccelerated="true" ... >

    View Article
  • Contents

    Why Use Opt-In Interstitial Ads?

    Recommended Option: In-App Rewards

    Overview

    Implementation for iOS

    Implementation for Android

    Server-to-Server Callbacks

    Overview

    Implementation for Vungle SDK v. 5.1 +

    Implementation for Vungle SDK v.1.0 - v.4.1

    Reward Configuration

    Example: Coins vs. Lives

    Security

    Authenticating Callbacks

    De-duplicating Callbacks And Preventing Replay Attacks

    Sample Code

    Why Use Opt-In Interstitial Ads?

    To maximize revenue while maintaining a great UX, Vungle recommends using opt-ininterstitials. Shown at natural breaks in the app, opt-ininterstitials deliver high revenue, especially if you follow ourrecommendation to make themnon-skippable. This placement also delivers a great UX, because users opt in to watch a video and are rewardedwith something of value, such as virtual currency, premium content, or in-app goods. The amount and type of reward given to a user for completing a video view is completely up to you. There are two ways of achieving this: in-app rewards, or server-to-server callbacks.

    Recommended Option:In-App Rewards

    Overview

    This is an alternative to using server-to-server callbacks. When a user successfully completes an ad view or clicks the download button, you can reward them directly in your app. The main benefit of this approach is that it's fairly simple to implement. If you're looking for something quick, and you're not concerned with replay attacks, this should do it.

    Vungle now offers a variety of ad formats with Dynamic Template ads. Unlike the traditional ad format, in which an ad play consists of a video play followed by an end card, we offer templates where the call-to-action (CTA) button is available during the video play. The users who complete the video ad, as well as those who click the button, should be rewarded.

    Note:Rewardedads are in some casesreferred to asincentivizedads;both termsalways refer to the same kind of ad. In the SDK code and in our Reporting API, we use the term 'incentivized'.

    Implementation for iOS

    Implement the VungleSDK Delegate, discussed in the Get Started with Vungle - iOS SDK v. 6.

    - (void)vungleWillCloseAdWithViewInfo:(VungleViewInfo *)info placementID:(NSString *)placementID;

    If the callback vungleSDKwillCloseAdWithViewInfo passes you a viewInfo dictionary with values of yes for the keys completedView or didDownload, the user has earned the reward.

    Implementation for Android

    Implement the EventListener interface, discussed in the Get Started with Vungle - Android SDK v. 6.

    public void onAdEnd (String placementReferenceId, boolean wasSuccessfulView, boolean wasCallToActionClicked)

    If the callback onAdEnd returns true for either wasSuccessfulView or wasCallToActionClicked, the user has earned the reward.

    Server-to-Server Callbacks

    Overview

    Server-to-server callbacks enable you to reward users for ad views with in-game currency or other rewards. When a user successfully completes an ad view, you can configure a callback from Vungle's servers to your own to notify you of the user's completed action.

    One benefit of this approach is control. This method allows you to make changes and updates directly on the server side, so there's no need to push an update. Another benefit is security in preventing replay attacks (when a valid data transmission is maliciously or fraudulently repeated or delayed).

    Implementation

    Note for Vungle SDK v. 6.x: Starting with SDK v. 6.1, we have moved the rewarded option to the dashboard, so that publishers can easily change the option without a code change. In your dashboard, find the checkbox to enable or disable the rewarded option at the placement level by navigating to Application Stage Placements Stage click the pencil icon Edit Placement.

    Note for Vungle SDK v.1.0 - v.4.1:

    For iOS, begin by setting the vunglePlayAdOptionKeyIncentivized option in your playAd object to yes.

    For Android, begin by setting the setIncentivizedFieldsoption in your AdConfig object to true.

    Implementation for all Vungle SDK Versions

    When a user watches 80% or more of a rewarded ad, it is considered a completed view. Vungle will then ping your servers with a callback URL, which looks something like this:

    http://acme.com/bugzBunny/reward?amount=1&uid=%user%&etxid=%etxid%&edigest=%edigest%

    We recommend using etxid and edigest, like this:

    http://acme.com/bugzBunny/reward? amount=1&uid=%user%&txid=%txid%&digest=%digest%

    Or use txid and digest that has been traditionally offered like this:

    http://acme.com/bugzBunny/reward?amount=1&uid=%user%&txid=%txid%&digest=%digest%

    Configure the callback URL in your app's Settings on the dashboard (as shown below).

    Most publishers only use %user%, %etxid%, and %edigest% for security, but all of the following are available:

    Variables

    Description

    %user%

    The username provided to the Vungle SDK via:

    iOS: The VunglePlayAdOptionKeyUser key of the options dict passed to playAd()

    Android: The Vungle.setIncentivizedUserIdpassed to playAd()

    %udid%

    A unique identifier for the device

    %ifa%

    iOS: Apple's unique identifier for the device.

    Android: This will return the Google Advertiser ID

    %etxid%

    A unique transaction ID for the completed view with server timestamp; transactionID:timestamp (recommended)

    %edigest%

    Security token to verify that the callback came from Vungle; refer to the Security section for details (recommended)

    %txid%

    A unique transaction ID for the completed view

    %digest%

    Security token to verify that the callback came from Vungle; refer to the Security section for details

    Note that %user% is the only variable you need to pass in. The rest will come back from Vungle's servers if you include them in the callback URL.

    Reward Configuration

    Now that you can reward a user for watching an ad, what do you give them? If you're giving out gems every time, it's pretty straightforward. But what if you want to get a bit more advanced? We don't have a built-in option for reward configuration, but here's what we recommend:

    Example: Coins vs. Lives

    Let's say your app has rewardedads in multiple places: both in your shop and at every third game-over. You want to reward the player with coins in the shop, and with a life at game-over. For each instance of playAd(), configure the user like this:

    userName123:coins or userName123:lives

    Then, when your servers receive Vungle's callback, parse %user% for the correct reward!

    Security

    Authenticating Callbacks

    In order to verify that callbacks you receive originated from Vungle, select the Secret Key for Secure Callback checkbox for your application. This will generate a secret key like this:

    4YjaiIualvm8/4wkMBRH8pctlqB1NyzhK3qUGUar+Zc=

    You can use the key to verify the origin of the callback as follows:

    Create the raw transaction verification string by concatenating your secret key with the transaction ID, separated by a colon, like this:

    transactionString = secretKey + ":" + %txid% or %etxid%

    Hash the bytes of the transactionString twice using the SHA-256 algorithm.

    Generate the transaction verification token by hex-encoding the output bytes of two sequential rounds of SHA-256 hashing, which will look something like this:

    transactionToken = 870a0d13da1f1670b5ba35f27604018aeb804d5e6ac5c48194b2358e6748e2a8

    Check that the transactionToken you generated equals the one sent in the callback query string as %digest% or %edigest%

    De-duplicating Callbacks And Preventing Replay Attacks

    There can be events where duplicate callbacks can reach your server due to network issues and replay attacks. To prevent a single callback from being replayed multiple times against your server, store authenticated transaction IDs and reject future callbacks with duplicate transaction IDs.

    Using etxid (recommended)

    etxid consists of hashed value that is unique for each advertisement event, followed by server side timestamp, therefore the entire string will be also unique.

    Using txid

    txid consists of hashed value of device ID, followed by device level timestamp, therefore you must incorporate the timestamp to enforce a cutoff line for rewarding.

    Extract the timestamp (in milliseconds) from the transaction ID like this:

    transactionMillis = transactionId.substringAfter(":")

    Check that transactionMillis is later than your cutoff and that transactionId has not been encountered since your cutoff.

    Sample Code

    These bits of sample code will help you implement server-to-server callbacks security! We have examples for: Node.js, Java, Python, and Ruby. Note that:

    The transaction_id canbe %txid% or %etxid% (recommended).

    For %etxid%, the verification hash should be %edigest%.

    Node.js Java Python Ruby

    Node.js

    var crypto = require('crypto');

    function isTransactionValid(secret, transaction_id, provided_hash) {

    return isTransactionRecent(transaction_id) &&

    isTransactionNew(transaction_id) &&

    createSecurityDigest(secret, transaction_id) === provided_hash;

    }

    function getTransactionTimestamp(transaction_id) {

    return parseInt(transaction_id.split(":")[1], 10) || null;

    }

    function isTransactionRecent(transaction_id) {

    // Does the transaction have a reasonable format?

    var tx_timestamp = getTransactionTimestamp(transaction_id);

    if (tx_timestamp === null) { return false; }

    // Is the transaction within a reasonable time range?

    var now = new Date().getTime();

    var time_diff = now - tx_timestamp;

    var hour_in_future = -1000 * 60 * 60, three_days_ago = 1000 * 60 * 60 * 24 * 3;

    return (time_diff < three_days_ago && time_diff > hour_in_future);

    }

    // Have we seen this transaction before?

    // NOTE: To scale beyond just this one node process, you'll need to put this in some

    // sort of centralized datastore. Any one that supports atomic insertions into a set

    // should do. The Redis database, with its SADD command, would be a good place to start.

    var known_transactions = {};

    function isTransactionNew(transaction_id) {// For %etxid%, extract unique event id from etxid, which is the string before :, and use it to identify unique ad events

    if (known_transactions[transaction_id]) { return false; }

    known_transactions[transaction_id] = true;

    return true;

    }

    function createSecurityDigest(secret, transaction_id) {

    var firsthash = crypto.createHash("sha256").update(secret + ":" + transaction_id).digest("binary");

    return crypto.createHash("sha256").update(firsthash,"binary").digest("hex");

    }

    Java

    import java.nio.charset.Charset;

    import java.security.MessageDigest;

    import java.security.NoSuchAlgorithmException;

    import java.text.ParseException;

    public class ServerCallbackSecurityExample {

    private static final long MAX_CALLBACK_AGE_MILLIS = 7 * 24 * 60 * 60 * 1000; // 7 days

    /**

    * Checks that a transaction is recent enough, signed with the secretKey, and not a duplicate.

    *

    * @param transactionId the transaction ID.

    * @param secretKey a shared secret.

    * @param verificationDigest the verification digest sent in the callback querystring.

    */

    public boolean isValidTransaction(String transactionId, String secretKey, String verificationDigest) throws NoSuchAlgorithmException {

    return isRecentTransaction(transactionId)

    && isDigestValid(transactionId, secretKey, verificationDigest)

    && isNewTransaction(transactionId);

    }

    protected boolean isRecentTransaction(String transactionId) {

    boolean isRecent = false;

    try {

    final long minCallbackAgeMillis = System.currentTimeMillis() - MAX_CALLBACK_AGE_MILLIS;

    final long transactionMillis = getTransactionMillis(transactionId);

    isRecent = (transactionMillis > minCallbackAgeMillis);

    }

    catch (ParseException exception) {

    // invalid transaction ID format

    }

    return isRecent;

    }

    protected boolean isDigestValid(String transactionId, String secretKey, String verificationDigest) throws NoSuchAlgorithmException {

    return createSecurityDigest(transactionId, secretKey)

    .equals(verificationDigest);

    }

    protected boolean isNewTransaction(String transactionId) {

    // TODO if transactionId is new, store the transactionId with its associated transactionMillis // For %etxid%, extract unique event ID from etxid, which is the string before ":", and use it to identify unique ad events

    return true;

    }

    protected long getTransactionMillis(String transactionId) throws ParseException {

    final int transactionMillisIndex = transactionId.lastIndexOf(":") + 1;

    try {

    if (transactionMillisIndex > 0 && transactionMillisIndex < transactionId.length()) {

    return Long.parseLong(

    transactionId.substring(transactionMillisIndex));

    }

    else {

    throw new ParseException("No timestamp in transaction ID", transactionMillisIndex);

    }

    }

    catch (NumberFormatException exception) {

    throw new ParseException("Invalid transaction ID timestamp", transactionMillisIndex);

    // invalid timestamp

    }

    }

    protected String createSecurityDigest(String transactionId, String secretKey) throws NoSuchAlgorithmException {

    final String verificationString = secretKey + ":" + transactionId;

    final MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");

    return toHexString(

    messageDigest.digest(

    messageDigest.digest(

    verificationString.getBytes(Charset.forName("US-ASCII")))));

    }

    protected String toHexString(byte[] bytes) {

    final StringBuffer hexStringBuffer = new StringBuffer();

    for (final byte byt : bytes) {

    hexStringBuffer.append(

    Integer.toString((byt & 0xff) + 0x100, 16)

    .substring(1));

    }

    return hexStringBuffer.toString();

    }

    }

    Python

    import hashlib, time

    def isTransactionValid(secret, transaction_id, input_hash):

    """Returns whether this transaction id / hash should be considered valid"""

    return isTransactionIDRecent(transaction_id) and \

    isTransactionIDNew(transaction_id) and \

    createSecurityDigest(secret, transaction_id) == input_hash

    def getTransactionTimestamp(transaction_id):

    """Will return the unix time (in milliseconds) of this transaction, or None if invalid"""

    parsed = transaction_id.split(":")

    try:

    return int(parsed[1]) if len(parsed) == 2 else None

    except ValueError as e:

    return None

    def isTransactionIDRecent(transaction_id):

    """Is this transaction within a reasonable time range?"""

    tx_time = getTransactionTimestamp(transaction_id)

    # Handle bad transaction:

    if tx_time is None:

    return False

    # Handle bad transaction times:

    now = int(time.time() * 1000)

    three_days_ago = now - (1000 * 60 * 60 * 24 * 3)

    one_hour_from_now = now + (1000 * 60 * 60)

    return ( three_days_ago < tx_time < one_hour_from_now )

    def isTransactionIDNew(transaction_id, known_transaction_ids=set()):

    """Is this a duplicate transaction?

    NOTE: We only use the Python set for simplicity. For better / more centralized solutions,

    you can use any datastore that supports atomic insertion into a set. For starters, try

    Redis with its "SADD" command.""" """For %etxid%, extract unique event ID from etxid, which is the string before ":", and use it to identify unique ad events"""

    if transaction_id in known_transaction_ids:

    return False

    # Else, valid:

    known_transaction_ids.add(transaction_id)

    return True

    def createSecurityDigest(secret, transaction_id):

    """Will return the string that the security hash should have been"""

    firsthash = hashlib.sha256()

    firsthash.update(secret + ":" + transaction_id)

    secondhash = hashlib.sha256()

    secondhash.update(firsthash.digest())

    return secondhash.hexdigest()

    Ruby

    require "openssl"

    require "digest/sha2"

    require "base64"

    require "time"

    # just some helper methods, ignore if using Rails

    class Fixnum

    SECONDS_IN_DAY = 24 * 60 * 60

    HOURS_IN_DAY = 24 * 60

    def days

    self * SECONDS_IN_DAY

    end

    def hour

    self * 60 * 60

    end

    def ago

    (Time.now - self)

    end

    def from_now

    (Time.now + self)

    end

    end

    def transaction_valid?(secret, txid, input_hash)

    transaction_id_recent?(txid) && transaction_id_new?(txid) && create_security_digest(secret, txid) == input_hash

    end

    def transaction_timestamp(txid)

    arr = txid.split(":")

    return arr[1].to_i if arr.size == 2

    end

    def transaction_id_recent?(txid)

    tx_time = transaction_timestamp(txid)

    return false if tx_time.nil?

    now = Time.now.to_i

    three_days_ago = 3.days.ago

    one_hour_from_now = 1.hour.from_now

    three_days_ago.to_i < tx_time && tx_time < one_hour_from_now.to_i

    end

    # For %etxid%, extract unique event ID from etxid, which is the string before ":", and use it to identify unique ad events

    def transaction_id_new?(txid, transactions = [])

    return false if transactions.include?(txid)

    transactions << txid

    return true

    end

    def create_security_digest(secret, txid)

    verification_string = "#{secret}:#{txid}"

    first_digest = Digest::SHA2.new(256).update(verification_string)

    Digest::SHA2.new(256).hexdigest(first_digest.digest)

    end

    View Article
  • Vungle has partnered with Tipalti to manage payments to our Publishers. All payment and tax information isstill fully managed by Vungle, while the payment processing isexecuted by Tipalti.

    To submit payment and tax information, please login into the dashboard. Click on our menu and select "Payment Info."

    1. View the upper right corner in the Publisher UI.

    2. Click the 3 dots (ellipsis)

    3. Choose My Account

    4. On the Account page locate Payment tab, then select Payment information

    Follow these steps toset-up your payment information:

    Step 1: Enter in your address information for you entity/company.

    [email protected]

    Step 2: Choose your payment method

    We offer different payment methods depending on the country you are located in. Select which payment method you would like. For information on the different payment methods we offer, please visit this link.

    You can also choose a Payment Threshold to control the minimum payment total before we issue out a payment.

    Step 3: Select your tax form

    In this section, please choose the tax form that best applies to you. If you do not know which form to select, you can go through the Tax Form Questionnaire at the bottom of this page. Here are some quick tips to help you along:

    Most US residents will fill out the W9 form.

    MostNon-US individuals will fill out the W8-BEN

    Most Non-US entities will fill out the W8-Ben-E

    Step 4: Congratulations.

    You're done and ready to receive your first payment from Vungle!

    --

    If you have anyquestions, please email.

    View Article
  • Contents

    Overview

    Host

    Authentication

    Request Headers

    Results

    Resource: GET /reports/performance

    Filter parameters

    Dimensions parameter

    Aggregates parameter

    Sample queries and responses

    JSON Revenue

    CSV Revenue

    Placement

    Overview

    The reporting API offers publishers a programmatic way to access data that is present on the dashboard. Your Reporting API Key isthe same for all of your apps. Each app hasa unique Reporting API ID, which you can findon its respective application page.

    Host

    Host:https://report.api.vungle.com/ext/pub/reports/performance

    Authentication

    Security is handled in the request header. Find your API key in the Reports page on the Vungle dashboard. If you don't already have an API Key, email [email protected] to request one!

    Request Headers

    Key

    Value

    Description

    Authorization:

    Bearer [API Key]

    API Key

    Vungle-Version:

    1

    APIVersion

    Accept:

    text/csv or application/json

    Accepted data format for results. Default is text/csv.

    Results

    Format: We support JSON and CSV outputs.

    Date range: Historical information is available for up to six months. To retrieve older data, email your account manager at [email protected].

    In the event of no data:Please note that if there is no data available for your query, Vungle sends back an empty 200 response. This indicates that the request has succeeded, but there is no data available to return.

    Resource: GET /reports/performance

    Filter parameters

    Use filter parameters to restrict the resultsto a subset of your performancedata. Most filters are optional, in which case Vunglereturns all results for that filter.

    Parameter name

    Format

    Action

    If unavailable

    Example

    start

    ISO8601 date

    Limits the result set to performance data no earlier than this date

    Rejects request

    start=2017-01-01

    end

    ISO8601 date

    Limits the result set to performance data no later than this date

    Rejects request

    end=2017-01-02

    country

    Comma-separated list of ISO 3166-1 Alpha-2 country codes

    Returns only performance data matching the listed countries

    Returns all countries

    country=US

    country=US,CA

    country=US,CA,AU

    applicationId

    Comma-separated list of Vungle Application IDs to return

    Returns only performance data for the listed applications

    Returns all applications

    applicationId=586e201e242e3fd308000220

    applicationId=586e201e242e3fd308000220,585849c3756684a50c0000a0

    incentivized

    true/false or 1/0

    Returns only performance data for incentivized or non-incentivized traffic

    Note:Rewardedads are in some casesreferred to asincentivizedads;both termsalways refer to the same kind of ad. In the SDK code, we use the term 'incentivized'.

    Returns both incentivized and non-incentivized

    incentivized=true

    incentivized=false

    Dimensions parameter

    Use dimensions to make yourreports more or less granular. Send dimensionsas a comma-separated list under a dimensions parameter. If you do not explicitly request a dimension, Vungle does not break the report downby that dimension.

    Using the dimensions parameter

    Parameter name

    Format

    Example

    dimensions

    Comma-separated list of specific strings, listed in the table below

    dimensions=platform

    dimensions=application,date,country

    Available dimensions

    Dimensionname

    Returns

    Example return

    platform

    Grouped by platform string

    platform

    iOS

    application

    Grouped by Vungle Application ID and name

    application id

    application name

    58086457cdf5f9eb6d000060

    Sonic Dash

    placement

    Grouped by PlacementID and name.

    For apps still usingVungle SDK v. 4.1 and below, whichdo not support placements, placement idand placement name will displayas null in our reporting, but aggregations such as views and publisher revenue will still be accurate. That is, non-updated devices will still be shown in the reports, but without placement breakdowns, whichwill be null.

    placementid

    placementname

    12345678

    Level 3

    date

    Grouped by date

    date

    2017-01-01

    country

    Grouped by country

    country

    US

    incentivized

    Grouped by incentivized traffic

    Note:Rewardedads are in some casesreferred to asincentivizedads;both termsalways refer to the same kind of ad. In the SDK code, we use the term 'incentivized'.

    incentivized

    true

    false

    For dimensions requiring a name lookup (for example, Application Name), if Vungle is unable to retrieve the lookup, we return an'Unknown' string in place of the name.

    Aggregates parameter

    Use aggregates to define which performance data interests you. Send aggregates as a comma-separated list under an aggregates parameter. If an aggregate is not in the list, Vungleassumes that you donot wish to receive that data.

    Using the aggregatesparameter

    Parameter name

    Format

    Example

    aggregates

    Comma-separated list of specific strings, listed in the table below

    aggregates=views

    aggregates=views,installs,ecpm

    Available aggregates

    Dimensionname

    Returns

    views

    integer

    completes

    integer

    clicks

    integer

    revenue

    integer

    ecpm

    (publisher revenue * 1000 / views) as a float

    Sample queries and responses

    Example 1: JSONRevenue

    Request

    curl -i -H "Authorization: Bearer [API KEY]" -H "Vungle-Version:1" -H "Accept:application/json" -X GET "https://report.api.vungle.com/ext/pub/reports/performance?dimensions=date,country,platform&aggregates=views,revenue&start=2017-03-01&end=2017-03-05"

    Response

    [

    {

    "platform" : "iOS",

    "date": "2017-03-01",

    "country": "US",

    "views": 1234,

    "revenue": 123.0,

    "ecpm": 99.67,

    },

    {

    "platform" : "iOS",

    "date": "2017-03-01",

    "country": "CA",

    "view": 35,

    "revenue": 2.0,

    "ecpm": 57.14,

    },

    ...

    ]

    Example 2: CSVRevenue

    Request

    curl -i -H "Authorization: Bearer [API KEY]" -H "Vungle-Version:1" -H "Accept:text/csv" -X GET "https://report.api.vungle.com/ext/pub/reports/performance?dimensions=date,country,platform&aggregates=views,revenue&start=2017-03-01&end=2017-03-05"

    Response

    Platform,date,country,views,revenue

    ios,2017-03-01,US,1234,123.0

    ios,2017-03-01,CA,35,2.0

    ...

    Example 3:Placement

    Request

    curl -i -H "Authorization: Bearer [API KEY]" -H "Vungle-Version:1" -H "Accept:application/json" -X GET

    "https://report.api.vungle.com/ext/pub/reports/performance?dimensions=placement&aggregates=views,revenue&start=2017-03-01&end=2017-03-05"

    Response

    [

    {

    "placement id" : "12345678",

    "placement name": "level 3",

    "views": 1234,

    "revenue": 123.0

    }

    ]

    View Article
  • AdMob Android adapter v6.4.11 is compatible with Vungle Android SDK v6.4.11. Documentation forintegrating AdMob Mediation with Vungle SDK (Android) resides on AdMob's Guide section, Integrating Vungle with Mediation.

    The instructions for Android Studio integration and manual integration can be found on AdMob's integration guide, Step 3: Import the Vungle SDK and Adapter.

    Use this guide as a supplement toAdMob's integration documentation as it has information about new features that are are yet to be covered by the official documentation. AdMob Android adapter v6.4.11 is compatible with Vungle Android SDK v6.4.11 and is tested with Google SDK v17.2.0

    If you are updating to Vungle Android SDK v6 using the Google Mobile Ads SDK, you must use Google Play Services Ads v12.0.0 or higher because we have added theonRewardedVideoCompleted() callback method to RewardedVideoAdListener. For more information, refer to the Google Mobile Ads SDK Release Notes.

    Ad Format

    v6.4.11 onwards supports AdMobs banner ads.To display a banner ad in the application, create an MREC placement on Vungle dashboard and configure this to a Banner ad unit on AdMob dashboard.Currently, Vungle supports banner size 300*250 and should be specified asMEDIUM_RECTANGLE as AdSize in the implementation.

    AdMob allows publishers to use same ad unit ID in multiple places at the same time but Vungle SDK supports only one instance of Banner for a given AdMob ad unit ID at any given time. Please do not attempt to use same Vungle Banner placement reference ID in multiple AdMob ad unit ID since adapter is not designed to handle such case and will lead to unexpected behavior. If you wish to have multiple Vungle Banner instances simultaneously at a given time using Vungle AdMob adapter, we would advise you to create separate ad unit IDs, pointing to different Vungle placements within one Vungle app ID.

    Sample code

    AdView adView = new AdView(this);adViews.add(adView);adView.setAdSize(AdSize.MEDIUM_RECTANGLE);adView.setAdUnitId(<AdUnit>);

    Network Specific Parameters

    The Vungle AdMob adapter continues to support network specific parameters and v6.4.11 and above will support an additional parameter setAutoRotateEnabled(bool) to play the ad as per device orientation

    Sample code

    Bundle extras = new VungleExtrasBuilder(placements) .setSoundEnabled(false) .setUserId("test_user") .setAutoRotateEnabled(true) .build();AdRequest request = new AdRequest.Builder() .addNetworkExtrasBundle(VungleAdapter.class, extras) // Rewarded video. .addNetworkExtrasBundle(VungleInterstitialAdapter.class, extras) // Interstitial. .build();

    Memory Settings

    Starting from v6.4.11, you can prevent the SDK from requesting ads or even initializing if the storage of your Android phone falls below a predefined threshold. If this happens, you will get an error similar to the following:

    There is not enough file system size on the device.

    Sample code:

    import com.vungle.mediation.VungleNetworkSettings;

    //Integer value sets the required minimum available free storage space to be able to initialize the SDKVungleNetworkSettings.setMinSpaceForInit(<INTEGER_VALUE>);//Integer value sets the required minimum available free storage space to be able to request an adVungleNetworkSettings.setMinSpaceForAdLoad(<INTEGER_VALUE>);

    Android ID

    From SDK v6.4.11 onwards, publishers can now restrict from passing Android ID from the device to the SDK

    Sample code

    VungleNetworkSettings.setAndroidIdOptOut(true);

    New Rewarded API

    As documented in AdMob instruction guide, v17.2.0 and higher supports caching multiple rewarded ads at the same time.

    Since Vungle does not support this feature,the Ad request for the second Load ad will not be filled by Vungle, rather it will be passed to the next ad network in the waterfall.

    View Article
  • If you're getting the following error message, then you will want to go ahead and follow the steps below to get the extension up and running.ArgumentError: Error #3500: The extension context does not have a method with the name...

    This error iscaused by thedx.jar file provided by Adobe. The dx.jaris used in compiling Android apps, however, the Adobe versionalso strips out java classes compiled with Java 1.7. This means that it gets rid of Vungle'sSDK.

    To resolve the issue, yousimply replace the dx.jar fromthe Adobe Flex SDK with the dx.jar fromtheAndroid SDK. Unlike Adobe's dx.jar, Google's version does not strip out these classes.

    So all you need to do is:

    COPY

    $ANDROID_SDK/build-tools/20.0.0/lib/dx.jar

    INTO

    $FLEX_AIR_SDK_HOME/lib/android/bin/dx.jar

    and thats it! Your Adobe Air extension should be back to serving ads in no time!

    If you're still having troubles please contact our tech support team for immediate assistance at [email protected].

    View Article
  • Vungle Android SDK supports the 64-bit requirement. Vungle Android SDK doesn't use any native code like c,c++ and is written entirely in non-native code. So we are supporting 64 bit already.

    64-bit CPUs deliver faster, richer experiences for your users. Adding a 64-bit version of your app provides performance improvements, makes way for future innovation, and sets you up for devices with 64-bit only hardware. StartingAugust 1, 2019, all the apps that use native code must provide a64-bit versionon GooglePlay. Here is the link where you can find more details about 64-bit requirement and expectations from Google.

    Note

    AdobeAir does not support 64 bit, and thats due to AdobeAir platform not our SDK. This Google doc shares that they have given Adobe time until Aug 2020 Get your applications ready for 64 bit

    View Article
  • What is the GDPR?

    The General Data Protection Regulation (GDPR) is the new European Union (EU) data protection law that becomes effective on May 25, 2018. GDPR streamlines and overhauls the existing EU privacy law (the Data Protection Directive), while giving individuals more control over their personal data.

    One significant update (particularly for the ad-tech industry), is a heightened standard for consent to collect and process user data, which places more responsibility on organizations to demonstrate compliance (such as by maintaining auditable data processing records).Any organizations engaging third party services (like Vungle) to collect and process data on their behalf will also need appropriate contracts in place to comply with the stricter requirements introduced by the GDPR.

    What does Vungle do?

    Vungle is the leading mobile in-app video advertising platform.We serve both advertisers (who wish to distribute ad content through our platform) and publishers of mobile applications (who want to display relevant ads to end users). You can find out more here.

    Does GDPR affect Vungle?

    GDPR applies to the collection, use and disclosure of all personal data in the European Economic Area, and ensures that any party who collects personal data does so pursuant to one of the laws approved grounds.Personal data, as defined in the GDPR, includes all data relating to an identified or identifiable end user, which includes personally identifiable information like names, phone numbers, etc. (which we currentlydo notcollect or process in providing our services), in addition to pseudonymous forms of personal data such as device-related identifiers and IP addresses (which we do collect).

    Vungle is principally acting as an independent controller of most of the personal data it collects and processes.Vungle is proactively working to ensure GDPR-readiness by the effective date.

    What is the ePrivacy Directive?

    Another existing EU law the e-Privacy Directive (colloquially referred to as the Cookie Law) requires consent before using tracking technologies (such as cookies, pixels, web beacons, and SDKs) to access information stored on an end users device.Due to the heightened consent standard addressed by GDPR (discussed above), discussion of the Cookie Law in connection with GDPR arises frequently.

    This also impacts Vungle because, as an ad network, Vungles proprietary technology includes a mobile SDK which, when integrated with a publishers mobile application, enables Vungle to gather device data so that Vungle can deliver end users more relevant ads from Vungles network of advertisers. However, because ad networks like Vungle have no direct relationship with the end users of the mobile applications displaying such ads, Vungle is actively working with its network of publishers to achieve an appropriate consent mechanism so that Vungle can collect and use the data it needs via its SDK.

    Publishers should likewise revisit their cookie consent mechanisms to ensure that they will meet the GDPR standard of consent (both for themselves and any service providers who may be assisting them). We are actively monitoring the regulatory and industry developments in this area, including the progress of the new (but still draft) e-Privacy Regulation which, once finalized, will replace the existing Cookie Law.Despite whatever revisions affect the Cookie Law, the requirement for consent to use tracking technologies is likely to remain.

    What is Vungle doing internally to comply with the GDPR?

    Vungle has embarked on a compliance project with support from external advisors to become GDPR-ready by the May 25, 2018 deadline.Some of the measures Vungle is taking include:

    Data Minimization establishing mechanisms to collect only data that is needed, and pseudonymising such data wherever possible;

    Data Retention implementing a maximum data retention schedule across all our systems so that we routinely delete or anonymise data wedon'tneed;

    Consentworking with publishers to obtain and record GDPR-level consent in connection with the Cookie Law;

    International Data Transfers finalizing its EU-US Privacy Shield certification (see more below);

    Data Mapping undertaking a data mapping exercise for the purpose of creating the necessary data processing records;

    Individual Rights formalizing processes around data subject rights to ensure that Vungle is able to respond comprehensively and within the timeframes pronounced by the GDPR;

    Transparency updating its privacy notices and internal policies for GDPR compliance;

    Vendor Agreements updating existing arrangements with third party subprocessors to ensure GDPR compliance as well as vetting new subprocessors; and

    Security ensuring continued use of adequate security measures to safeguard any data collected and processed on systems owned or managed by Vungle.

    Vungle is committed to implementing its GDPR readiness program and understands the importance of a successful transition to GDPR for its customers.

    Does Vungle transfer data internationally?

    Vungle is headquartered in the United States, but has offices in the EU and its technology is incorporated in mobile applications that have users in the EEA. Therefore, Vungle will process personal data that originates from the EEA on its servers and facilities in the United States.

    The GDPR replicates the Data Protection Directive restrictions on transferring data outside the EEA.Transfers are permitted only if certain safeguards are in place, such as by self-certifying to the EU-US Privacy Shield.Accordingly, Vungle is in the process of certifying to the EU-US Privacy Shield to protect all transfers of non-HR European data to Vungle in the US.

    What is legitimate interest?

    Legitimate interest is a GDPR-related legal provision for processing personal data within relevant EU member states. In certain cases, publishers use legitimate interest as a valid legal basis for processing user data. To facilitate our publishers, Vungle provides legitimate interest for all accounts. For more information, please see vungle.com/privacy.

    How do I enable or disable legitimate interest?

    Go to My Account in your publisher platform and select the Overview tab Scroll down to Legitimate Interest to enable or disable it.

    Vungles Privacy team

    Where can I get more information?

    You can find more information by reading:

    GDPR Publisher Q&A and Implementation Details

    Opting Out of Performance-Based Advertising

    Vungle Data Privacy Addendum (Advertisers)

    If you have any questions or require assistance please contact.

    View Article
  • This article explainsthe variety of methods and schedulesby which Publishers can receive payment from Vungle, and the minimum thresholds, fees, and other details associated with each option.

    Contents:

    Payment methods, including:

    A quick word about Tipalti, Vungle's payment portal

    Minimum threshold to receive payment

    Payment schedules

    Payment methods

    PAYPAL

    PayPalis the quickest way to receive yourfunds, because it is so automated. The fees are relativelyhigh, and are based on the Publisher's location.

    Min.Amt. to Initiate Payment

    Fixed Fee per Payment

    Fee as % of Payment

    Maximum Fees per Transaction

    (U.S.)

    USD $50.00

    USD $1.00

    2%

    USD $2.00

    (International)

    USD $50.00

    USD $1.00

    2%

    USD $21.00

    ACH

    ACHis only applicable to US residents. Our bank charges a low fee, and any other chargedependsentirely on the Publisher's bank. This method is also fairlyquick, and will normally take between 1 - 4 business days.

    Min.Amt. to Initiate Payment

    Fixed Fee per Payment

    Fee as % of Payment

    MaximumFees per Transaction

    USD $50.00

    USD $0.75

    0%

    No maximum

    WIRE TRANSFER

    The fees are fairly high for Wire Transfers. Tipaltiimposes a fee on each wire, and the recipient'sbank normally imposes a fee as well. In the case of international wires, there is an additional 2.5% fee if the payment must be converted to your local currency.The waittime fora Publisher to receive a wire payment dependsonthe Publisher's bank.

    Min.Amt. to Initiate Payment

    Fixed Fee per Payment

    Fee as % of Payment

    MaximumFees per Transaction

    (U.S.)

    USD $1000.00

    USD $15.00

    0%

    No maximum

    (International)

    USD $1000.00

    USD $18.00

    2.5% fee for currency conversion

    No maximum

    eCHECK

    eChecks areconvenient for bank accounts that are not set up to receive USD currency.In the case of non-USD currency,there is an additional 2.5% fee if the payment must be converted to your local currency.This method typically takes 1-2 days.

    Min.Amt. to Initiate Payment

    Fixed Fee per Payment

    Fee as % of Payment

    MaximumFees per Transaction

    USD $1000.00

    USD $5.00

    2.5% fee for currency conversion

    No maximum

    CHECK

    Checks are only available in USD currency and to U.S.-based Publishers. Checks are processed in-house, not through Tipalti, so there are nofees imposed on payment by check.However,this method usually takes the longest to reach a Publisher.

    Min.Amt. to Initiate Payment

    Fixed Fee per Payment

    Fee as % of Payment

    MaximumFees per Transaction

    USD $50.00

    None

    0%

    No maximum

    A quick word about Tipalti, Vungle's payment portal

    Tipalti is Vungle's payment portal, and we currently use it to processfour types ofpayment methods: PayPal, ACH, Wire Transfer, and eCheck. In addition, Vungle can pay Publishers by regular check, which we process in-house. All options, along with any associated fees, are described in the table above.

    Note that any fees imposed by Vungle are deducted before we initiate the transaction with Tipalti, so fees imposed byTipalti impact yournet payment from Vungle.Learn how to set up your Tipalti account here.

    Minimum threshold to receive payment

    There is a minimum threshold for Vungle to pay you (the Publisher), which is set by Tipalti (or by Vungle for checks), and depends on thepayment method you have selected. The table abovelists the minimum payment amount for each payment method, along withany additional transaction fees imposed by Tipalti.

    Payment schedules

    By default, we pay out to our publishing clients on a Net 60 schedule,andconduct monthly revenue payouts at the very end of the month. For instance, revenue for the month of January is calculated on January 31 and, by default, the Publisher is paid at the end of March. (Note that Publisher may not receive the funds immediately, as it takes time for the payment to be received by the beneficiary.)

    We provide the following payment term options:

    Net 60: By default, all publishers will be paid within 60 days of the last day of the month of earnings.

    Hold Payment:If the Publisher does not want to receive payments, we can hold their payments. Once readyforus to release their payment, the Publishermust stilladhere to the minimum payout, along with the Net60 schedule.

    View Article
  • "WRITE_EXTERNAL_STORAGE" is a recommended permission but not a mandatory one. We suggest to include this permission but feel free to remove it if you have any conflicts.

    If you are implementing the Vungle SDK asAAR via Maven(and not implementing viaJARs), please add below line to your project manifest to remove the"WRITE_EXTERNAL_STORAGE" permission.

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18" tools:node="remove"/>

    View Article
  • Existing manifest permission with maxSdk version:

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18" />

    It is recommended to have"WRITE_EXTERNAL_STORAGE" permission. But if you are implementing the Vungle SDK as AAR via Maven(and not implementing via JARs), and want to keep the permission in your manifest without any specified SDK version targeting, please add the below line to your manifest file:

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="replace"/>

    View Article
  • Advertisers use variouspayment models when they pay Publishers for showing their ads, and this sometimes causes confusion. The revenue model for Publishers doesn't directly correlate to the structure of the advertising payment model.

    For starters, let's understand the Advertiser models,whosetermscan be confounding. Advertisers can choose to pay Publishersforimpressions (CPM), completed views (CPCV), or installs (CPI), explained below:

    Cost per Install (CPI) is the most commonly used model by app or game advertisers. The advertiser only pays the Publisher if a user watches an ad, downloads the app advertised in the video,and opens theapp at least once. Without this event, the Advertiser doesn't pay. To translate this to Publisher revenue, we calculatea conversion rate (how well the ad converts with users) over 1000 views.

    Cost per Mille (CPM) is a straightforward choice by advertisers.For advertisers, the flat CPM metric is calculated as Cost (Views * 1000) and tells them what it costs them to show 1,000 video impressions of their ad. In this case, a view is defined as any portion of the ad being watched (don't confuse it with a completed view, below.)

    Cost Per Completed View (CPCV)is a commonly used model by brand advertisers.Avideo trailer is defined ashaving been watched or completed if 80% or more of the video has been played (for example, 12 seconds of a 15-second video). Without this event, the Advertiser doesn't pay.

    Publisher revenue, on the other hand, is based an Effective Cost per Mille (eCPM) model. Cost Per Mille is the cost for every 1,000 impressions, also called views (not to be confused with completed views). This formula is similar to the flat CPM, but takes fill rate into account, and is calculated as follows:

    Publisher eCPM = Revenue Impressions * 1000

    View Article
  • If you have issues receiving your payments, please contact [email protected] or your Account Manager.

    Common reasons for payment delays include:

    You have not filled out the required forms.

    You have not reached the minimum earnings to get paid out.

    Payments weredelayed in the mail, within Vungle, or at the client's bank.

    View Article
  • If you find that your Vungle account or your app has been deactivated, you may have violated our publisher terms. You can review them here.

    Please review your application for any violation of our publisher terms, especially Section 4(D):

    Ad Restrictions. Developer may not, and may not authorize or encourage any third party to: (i) generate fraudulent impressions of, or fraudulent clicks on any Vungle Ads, including through repeated manual clicks, the use of robots or other automated tools or any other method that may lead to artificially high numbers of impressions, downloads, installs or clicks; (ii) edit, modify, filter, or change the order of the information contained in any Vungle Ad, or remove, obscure or minimize any Vungle Ad in any way; (iii) redirect an end user away from any web page or app accessed by an end user after selecting or clicking on any part of a Vungle Ad ("Advertiser Page"), provide a version of the Advertiser Page different from the page an end user would access by going directly to the Advertiser Page, or intersperse any content between the Vungle Ads and the Advertiser Page; and (iv) utilize incentivized installs. Developer shall promptly notify Vungle if it suspects that any third party may be tampering with, abusing or manipulating the Vungle Platform or the Vungle Ads within the Developer App. Vungle may suspend Developers use of the Vungle Platform and/or terminate this Agreement immediately should Developer violate the foregoing provisions of this Section, and Developer shall not be entitled to any revenue associated with the applicable campaign(s).

    If you find that your account or application has been deactivated without violating our publisher terms, please contact Vungle Support.

    View Article
  • You can transfer an app between accounts.

    Note that the app's historical data will not be transferred. To retrieve the app's historical data before the transfer, download its reports. You can download reports from the Vungle Dashboard or use our Reporting API 2.0.

    To transfer an app to a different account, email Vungle Tech Support with the following information:

    Vungle Account ID and company name (account to which the app currently belongs)

    Vungle Application ID (of the application to be moved)

    Vungle Account ID and company name (account to which you want to move the app)

    Questions or concerns regarding revenue (for example, transfer of revenue)

    If you do have revenue-related questions, please include [email protected] on the same email.

    View Article
  • Ordinal view data reporting enables publishers to track performance on a true view number basis. The publisher can pass the true ordinal view number for each ad to the Vungle SDK, enabling Vungle to generate reports based on this data.

    Participating in Ordinal Data Reporting

    Before showing an ad, your mediation adapter must set the mediation ordinal. This ordinal indicates how many ads have been shown in the game session, including ads shown by ad networks other than Vungle. It is passed through the Vungle SDK to our server, which generates reports based on the data.

    Example

    Your mediation adapter has shown two ads from other networks. Now it's showing one from Vungle. Because this is the third ad in the game session, the mediation ordinal should be '3'.

    For Android

    // Create a new AdConfig objectfinal AdConfig overrideConfig = new AdConfig();overrideConfig.setOrdinalViewCount(3);VunglePub.getInstance().playAd("DEFAULT123", overrideConfig);

    For iOS

    // Pass in dict of options, play adNSError *error = nil;[[VungleSDK sharedSDK] playAd:self options:@{ VunglePlayAdOptionKeyOrdinal : @(3) } placementID:@"DEFAULT123" error:&error];

    View Article
  • DAU - (Daily Active Users) - This would be the total number of active users of the game in a given day.

    Session Count - Session count refers to how many times users have gone into your app

    Avg. Session Length - The averagelength of a session

    Views - A view is when the ad is visibly shown

    Impressions - An impression is when an ad is called to play

    Completes - The total number of video ads watched to completion

    CPM - Cost per mille/thousand

    Clicks - When a user clicks on the call to action button on the ad

    CampaignID - The campaign application id of thecampaign

    Initializations - Total number of unique SDK initializations for the app

    Installs -When a user installs an advertised application

    Daily Spend - How much advertising money was spent

    If you have any requests for additional definitions,please write us at [email protected]

    View Article
×
Rate your company