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 in our GitHub repository.
Before You Begin
Requirements
- As of Vungle Windows SDK v6.11.0, Vungle supports Windows 11. The support for Windows 8.1 has been deprecated as of Vungle Windows SDK v6.10.1, making Vungle Windows SDK v6.8.0 the last SDK that supported Windows 8.1. Vungle Windows SDK now supports Universal Windows Platform application only.
-
As of Vungle Windows SDK v6.11.0, Vungle supports ARM64. This requires you to set your minimum target version in Microsoft Project to Windows 10.0 build 16299 (also known as the Fall Creators Update, or version 1709). To do this:
- Right-click on the project in Visual Studio.
- Select Properties.
- Update Min version to ‘Windows 10 Fall Creators Update (10.0; Build 16299)’ or higher.
Note that this is required for all publishers, even those unaffected by ARM64.
- The integration requires a Liftoff account, so create an account if you haven’t already done so, and create a new Windows Universal Windows app in your account. Refer to the Add Your Apps and Placements section of our Using the Monetize Dashboard article to learn how to set up your Windows app and placements in the Liftoff Monetize dashboard.
Download the SDK
We strongly recommend following the NuGet integration steps to download the Vungle SDK for Windows. If you opt for the manual integration option, you can download the Vungle SDK for Windows here: https://publisher.vungle.com/sdk/sdks/windows.
Reference: Sample App
Refer to the sample app we have provided as you integrate: https://github.com/Vungle/Windows-SDK/tree/master.
Step 1. Integrate the Vungle SDK Into Your Project
There are two ways to add Vungle to your Visual Studio project: using NuGet (recommended) or manual integration.
Option 1. NuGet Integration (Recommended)
- In Visual Studio, right-click on your Project's name in the Solution Explorer and select Manage NuGet Packages.
- Click Browse, enter ‘Vungle’, and select Vungle SDK.
- Click Install.
Option 2. Manual Integration
- Download the Vungle Windows SDK and extract the archive.
- In Visual Studio, create a new Universal Windows project using the correct template for your application and programming language.
- Add a reference for your project to
VungleSDK.winmdyou downloaded. - Make sure that your project has the
internetClientcapability in thepackage.appxmanifestfile. The Internet (Client) capability is turned on by default when you create a new project. You can verify this in Visual Studio or via manual edit. Note that when you create a new UWP app, this capability is turned on by default.- To verify
internetClientcapability in Visual Studio:- In Visual Studio, double-click
appxmanifestin Solution Explorer. - Select Capabilities.
- Confirm that the Internet (Client) option is checked.
- In Visual Studio, double-click
-
To ensure
internetClientcapability via manual edit, open thepackage.appxmanifesetfile and addinternetClientto theCapabilitiessection:<Capabilities> ... <Capability Name="internetClient" /> ... </Capabilities>
- To verify
Step 2. Import the VungleSDK Namespace
Import the VungleSDK namespace into your code file as follows:
using VungleSDK;
Step 3. Obtain a VungleAd Instance
Starting with Vungle Windows SDK v6.3.0, the VungleAd instance takes only one parameter: your Vungle app ID. In this example below, replace appId with your Vungle app ID.
VungleAd sdkInstance;
string appId = “VUNGLE_APP_ID”;
sdkInstance = AdFactory.GetInstance(appId);Next, set up an initialization handler as instructed below, to know when Vungle has finished initialization and is ready for you to call other Vungle method calls, such as LoadAd() and PlayAdAsync().
Step 4. Add Code
Create and Register 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 if you need any UI interaction or updates resulting from an event listener, you must do that on 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
}
);Diagnostic
This event handler is called when the SDK wants to print diagnostic logs. Use this handler to debug problems when integrating Vungle into your application.
Sample code:
//Register event handler
sdkInstance.Diagnostic += SdkInstance_Diagnostic;
...
// 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);
}OnInitCompleted
This event handler is called immediately after initialization of the SDK has completed. Wait for this event to fire before calling any Vungle methods such as LoadAd() or PlayAdAsync().
Inside this handler, you may choose to call LoadAd() ad for any placements you want to load right away, to ensure that they will be loaded immediately, and that the ads are available to play as soon as possible. You can later use IsAdPlayable() to check if the ad is loaded, and then PlayAdAsync() to play the ad.
If you don't want to use an event handler, you can also use the IsInitialized() call to determine if the SDK is initialized. If e.IsInitialized is 'false' when this event is fired, first check to make sure that the app ID you used in your call to GetInstance() is correct. If the app ID is correct, and you have very recently set up or changed your Vungle account on our Monetize Dashboard, wait 30 minutes before trying again.
Sample code:
//Register event handler
sdkInstance.OnInitCompleted += SdkInstance_OnInitCompleted;
...
// 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;
// Initialization was a 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)";
}
}
}
// Initialization failed; check to make sure your appID is correct, and that your machine is connected to the Internet
else
{
placementsInfo += "\n\t" + e.ErrorMessage;
}
System.Diagnostics.Debug.WriteLine(placementsInfo);
// If we are updating the UI, we need to run our update code on the UI thread
await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
new DispatchedHandler(() => NotifyInitialization(e.Initialized)));
}OnAdPlayableChanged
Create an event handler for the OnAdPlayableChanged event. This event handler is called when the ad availability state changes. This event is called shortly after you call LoadAd() when required ad assets complete downloading.
In your code, wait for this event to fire before playing a PlayAdAsync(). After you call LoadAd(), this event fires to notify you whether the ad was successfully downloaded. Note that sometimes an ad can fail to load due to a temporary shortage of appropriate ads.
- If
e.AdPlayableis 'true', then your ad is ready to play. If you callPlayAdAsync(), be sure to do that on the UI Thread. - If
e.AdPlayableis 'false', then try to callLoadAd()again at a later time.
You can identify which placement triggered the event by checking e.Placement, and you can check if the placement has loaded successfully by checking e.AdPlayable.
If you don’t want to use an event handler to determine when a placement is loaded or playable, you can instead use the IsAdAvailable() method to poll for when the placement is ready to play.
// Event handler for OnAdPlayableChanged event
private async void SdkInstance_OnAdPlayableChanged(object sender, AdPlayableEventArgs e)
{
// If the Ad has been successfully loaded, then
if (e.AdPlayable == true)
{
// e.Placement - Vungle placement ID which has had a change in availability;
// that is, this placement is now either ready to play (
// If you need to update the UI, run asynchronously on the UI thread
await CoreApplication.MainView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
new DispatchedHandler(() => methodToUpdateUI(e.Placement)));
}
else
{
// You may need to try to call LoadAd() again later, as Vungle may be short on Ad supply
}
}OnAdStart
This event handler is called before playing an ad. You can use this handler to perform actions such as pausing your application's background music so that it doesn’t interfere with sounds from the playing advertisement.
Sample code:
//Register event handler
sdkInstance.OnAdStart += SdkInstance_OnAdStart;
...
// 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);
}
CampaignID and CreativeID
Starting with Vungle Windows SDK v6.8.0, the OnAdStart event will pass CampaignID and CreativeID within AdEventArgs parameter which can be used to track creative that is just about to be displayed.
The following contains an example of how users can access CreativeID and CampaignID values.
// e.CreativeID - Vungle Creative ID in string
// e.CampaignID- Vungle campaign iD in string
private void SdkInstance_OnAdStart(object sender, AdEventArgs e)
{
System.Diagnostics.Debug.WriteLine(“CreativeID: “ + e.CreativeID + "\nCampaignID is “ + e.CampaignID);
}OnAdEnd
This event handler is called when the user closes the ad 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, like music or sounds.
Sample code:
//Register event handlers
sdkInstance.OnAdEnd += SdkInstance_OnAdEnd;
...
// 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);
}Step 5. Integrate Ad Formats
Complete your SDK integration for each ad format you plan to display in your app. Refer to our instructions for each ad format:
Integrate Interstitial and Rewarded Ads
About Interstitial and Rewarded Ads
- Interstitial ads: These are full-screen ads that cover the interface of your app. They're typically displayed at natural transition points in the flow of your app, such as between activities or during the pause between levels in a game. Some interstitial ads are rewarded ads.
-
Rewarded ads: These ads deliver a great
user
experience by offering users something of value in exchange
for
watching or engaging with an ad. This exchange is typically
a
reward within your app, such as extra lives in a game, virtual
currency, or a hint in a puzzle (you determine the nature
and
amount of the reward). Shown at natural breaks in the
app,
rewarded video ads deliver high revenue, especially if you
follow
our recommendation to make them non-skippable.
There are two ways to integrate rewarded ads: in-app rewards (recommended, and described below), or server-to-server callbacks (refer to our FAQ article on this topic). With in-app rewards, 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 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.
Load an Ad for a Placement
To load an ad, call LoadAd and allow enough time
to
download the ad assets. Then wait for OnAdPlayableChanged
to 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:
await 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);
}
Customize Rewarded Ads (Optional)
These are the available properties in the AdConfig
object
instance.
| Options |
Default Value/ Type |
Description |
|---|---|---|
UserId
|
null string |
Passes the unique user ID to your application to verify that this user should be rewarded for watching an rewarded ad when server-to-server callback is used for verification. |
IncentivizedDialogTitle
|
“Close this ad?” string |
Sets the title of the confirmation dialog when skipping an rewarded ad. |
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 rewarded ad. |
IncentivizedDialogCloseButton
|
"Close" string |
Sets the 'cancel' button text of the confirmation dialog when skipping an rewarded ad. |
IncentivizedDialogContinueButton
|
"Continue" string |
Sets the 'keep watching' button text of the confirmation dialog when skipping an rewarded ad. |
The options for SoundEnabled and rewarded ad close
dialog
for Dynamic Template ads are available on the dashboard to configure.
Programmatic configuration will only apply to legacy ads.
Integrate Banner Ads
About Banner Ads
Starting with Vungle SDK v6.5.2 for Windows, Vungle supports banner ads. Both MREC and banner ads require API version 16 or higher.
Similar to MREC ads, banner video ads are rectangular ads occupying a location anywhere within the app's layout, typically displayed on the top or bottom of the screen, so that the user can continue to interact with the app while the ad is playing. 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 must be either 320x50, 300x50, or 728x90 (for tablets).
Banner Ad Requirements
- Vungle SDK v6.5.2 or higher for Windows
- Windows 10 UWP
Supported Banner Sizes
The container size to render banner ads can be 320 x 50, 300 x 50 or 728 x 90 (for tablets). You can set banner ads anywhere on the screen, and the user can continue using the app while the ad plays.
| Banner Size | Dimensions |
|---|---|
VungleBannerSizes.Banner_320x50
|
320x50 |
VungleBannerSizes.BannerShort_300x50
|
300x50 |
VungleBannerSizes.BannerLeaderboard_728x90
|
728x90 |
Integrate Banner Ads
Use VungleAdControl to load and play a banner
ad in a container.
For
a simpler and easier integration,
you can hand control over to VungleAdControl, and
integrate using
XAML only. For an
integration that gives you more detailed control,
you can specify the ad container in XAML and programmatically
control the banner
ad.
Option 1. Simple Banner Integration Using XAML
You must declare VungleAdControl with the Vungle
app ID and placement
ID for the banner placement. Specify that this
VungleAdControl is
for a banner ad by passing isBannerAd set to 'True'
and allow it
to automatically load and play a banner ad by passing
AutoRun set
to 'True'.
Sample code:
<UI:VungleAdControl x:Name="vungleBannerControl" AutomationProperties.AutomationId="vungleBannerControl"
IsBannerAd="True"
AutoRun="True"
<!-- Specify dimensions: 320x50, 300x50, 728x90 -->
Width="SIZE_OF_WIDTH"
Height="SIZE_OF_HEIGHT"
AppID="YOUR_VUNGLE_APP_ID"
Placement="YOUR_BANNER_PLACEMENT_ID"
</UI:VungleAdControl>
Option 2. Banner Integration With Programmatic Control
You can use XAML in conjunction with code to programmatically
control when to
LoadBannerAd, PlayBannerAd, or
LoadAndPlayBannerAd to load and play banner ad at
your preferred
timing in your app's lifecycle.
-
Specify the ad container In XAML. You must configure
VungleAdControlin XAML withisBannerAdset to 'True'. Specify the ad container size to fit the banner size that you want to display by passing the correctWidthandHeightvalues.
Sample XAML:<UI:VungleAdControl x:Name="vungleBannerControl" AutomationProperties.AutomationId="vungleBannerControl" IsBannerAd="True" Width="320" Height="50" > </UI:VungleAdControl> -
Set the app ID for
VungleAdControl. Start by sending the app ID for theVungleAdControlusingAppIDAPI. Note that the Vungle SDK is a singleton class, and you can use only one app ID at any one time. If you are playing a banner ad with fullscreen ads, pass in the identical app ID that you use in theGetInstancefunction to initialize the SDK.Instantiate
VungleAdControl:VungleSDKConfig sdkConfig = new VungleSDKConfig(); sdkConfig.DisableBannerRefresh = true; // Default: false sdkInstance = AdFactory.GetInstance(vungleAppID, sdkConfig); this.vungleBannerControl.AppID = vungleAppID;
Load and Play a Banner Ad
You can load and play a banner ad at the same time using the
LoadAndPlayBannerAd API. If you prefer to preload
a banner ad and
play it later, you can use the LoadBannerAd and
PlayBannerAd instead, to have finer control of the
banner placement
timing. You must pass the placement ID for banner ad and supported
banner size
when using these APIs, called on a UI thread. You can use
StopBannerAd to stop displaying a banner ad at anytime.
LoadAndPlayBannerAd:
await vungleBannerControl.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
{
this.vungleBannerControl.LoadAndPlayBannerAd("YOUR_PLACEMENT_ID", VungleBannerSizes.Banner_320x50);
});
LoadBannerAd:
this.vungleBannerControl.LoadBannerAd("YOUR_PLACEMENT_ID", VungleBannerSizes.Banner_320x50);
PlayBannerAd:
this.vungleBannerControl.PlayBannerAd("YOUR_PLACEMENT_ID", VungleBannerSizes.Banner_320x50);
StopBannerAd:
this.vungleBannerControl.StopBannerAd();
Integrate MREC Ads
About MREC Ads
Starting with Vungle Windows SDK 5.1.0+, Vungle supports MREC video ads. MREC is an abbreviation for "medium rectangle" ads. Unlike interstitial ads, MREC ads do not require a fullscreen view. Similar to banner ads, MREC video ads are rectangular ads occupying a location anywhere within the app's layout, typically displayed on the top or bottom of the screen, so that the user can continue to interact with the app while the ad is playing. The container size to render an MREC ad is the industry standard: 300x250.
VungleAdControl achieves video ads in MREC 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.
MREC Ad Requirements
- Windows SDK 5.1.0+
- Windows 10 UWP
- MREC placement configured on Liftoff Monetize dashboard
-
VungleAdControlwith width 300 and height 250
VungleAdControl
Vungle MREC creatives are optimized to play in viewing container
with size of
300 x 250. Make sure the viewing size in VungleAdContrl
is no smaller
than 300 in width and 250 in height.
.xaml
<UI:VungleAdControl x:Name="embeddedControl"
Width="300"
Height="250" />
Load, Play, and Close an MREC Ad
Load an MREC Ad
Loading a MREC ad using a MREC placement is identical as loading a full-screen ad.
.cs
sdkInstance.LoadAd("MREC_PLACEMENT_REFERENCE_ID")
Play an MREC Ad
Playing an ad using VungleAdControl requires you
to pass
AppID, Placements, and
Placement. You
can also configure MREC ads to start playing as muted by setting
SoundEnabled to false.
| Parameter | Description |
|---|---|
AppID
|
Application ID must identical |
Placement
|
Placement reference ID for your MREC |
SoundEnabled
|
Set to false to start playing muted
(optional,
default is true)
|
.cs
embeddedControl.AppID = "VUNGLE_APP_ID";
embeddedControl.Placement = "MREC_PLACEMENT_REFERENCE_ID";
embeddedControl.SoundEnabled = false; // Optional (default = true)
await embeddedControl.PlayAdAsync();
Stop Displaying an MREC Ad
You can use StopBannerAd to stop displaying an MREC
ad at anytime.
.cs
embeddedAdControl.StopBannerAd();
Alternative: Simple MREC Integration Using XAML
VungleAdControl provides a simpler way to integrate
MREC ads if
you don't need event listeners, or to control the timing of ad
load. Once the
SDK is initialized, it will load an MREC ad automatically, and
you can issue
PlayAdAsync once the ad assets complete downloading.
.xaml
<UI:VungleAdControl x:Name="embeddedControl"
Width="300"
Height="250"
Placement="MREC_PLACEMENT_REFERENCE_ID"
SoundEnabled="False" />
.cs
await embeddedControl.PlayAdAsync();
Step 6. Configure Advanced Settings
Follow these instructions to fine-tune your app's integration with additional configuration options, such as GDPR, CCPA implementation, and many other settings.
As of July 1, 2020, California Consumer Privacy Act (CCPA) will be enforced and publishers must updated to Windows SDK 6.11.0 or higher to comply with CCPA.
The AdFactory.UpdateCcpaStatus() method takes the user's consent status to specify whether the user has OptedIn or OptedOut and AdFactory.GetCcpaStatus() method returns current CCPA status for the user.
In accordance with CCPA, the consent status is opted in by default unless UpdateCcpaStatus() has been explicitly called to set it as opted out.
// Update CCPA consent status
public static void UpdateCcpaStatus(CcpaConsentStatus status)
// Usage example of CCPA API
// To set the user's CCPA status to opted in:
AdFactory.UpdateCcpaStatus(CcpaConsentStatus.OptedIn)
// To set the user's CCPA status to opted out:
AdFactory.UpdateCcpaStatus(CcpaConsentStatus.OptedOut)
// To find out what the user's current consent status is:
CcpaConsentStatus currentCcpaStatus = AdFactory.GetCcpaStatus();Generally speaking, the Children’s Online Privacy Protection Act (COPPA) regulates the collection, use, and disclosure of personal information for children under the age of 13 by certain websites and online services (including mobile apps). Compliance with COPPA is a legal issue and we suggest you seek the advice of an attorney in determining compliance. Additionally, for more information on COPPA, please refer to the Federal Trade Commission's COPPA FAQ.
Liftoff has tools to assist publishers with COPPA compliance. In addition to use of settings on the Liftoff Monetize Dashboard, Liftoff offers features within the Vungle SDK using the COPPA API. This is available for early access with Windows SDK v.6.11.0.
COPPA Compliance at the App Level
Liftoff provides tooling in the Monetize Dashboard to indicate COPPA compliance for each app. When defining your app in the Liftoff Monetize Dashboard, you must indicate to Liftoff whether your app is directed toward children under age 13. Depending on your setting, Liftoff will globally treat all traffic for the app as subject to COPPA or not. If you indicate that your app is not directed toward children under 13, COPPA settings will not apply at the app level, and can then be indicated at a more granular level (see COPPA Compliance at the Device Level).
COPPA Compliance at the Device Level
Starting with SDK v.6.11 early access, Vungle provides an optional method for you to indicate at the device level whether the user within the given mobile app is under or over the age of 13 by using the SDK COPPA API. The SDK COPPA API is most appropriate in cases of apps that legally can implement an age screen or age gate in accordance with COPPA, rather than treating all users as under 13. If you believe your app as a whole is primarily directed to children under the age of 13 as set forth in COPPA and related guidance, the COPPA Dashboard settings are more appropriate for you.
Recommendations for Using Vungle's COPPA Compliance Tools
Pursuant to the Vungle SDK License and Publisher Terms, it is the publisher’s responsibility to ensure compliance with applicable laws, including COPPA. Vungle is not liable for COPPA violations resulting from incorrect settings communicated via the SDK COPPA API. Consider the following recommendations to help you ensure COPPA compliance.
- Use the SDK COPPA API for mixed-audience apps. Use the SDK COPPA API if:
- You have confirmed you are a “mixed-audience app” under COPPA
- You have implemented an age gate or age screen
- You have stated that for your app “COPPA settings will NOT apply” in the Publisher Dashboard (otherwise, a COPPA-compliant setting in your Dashboard will override any API settings to the contrary)
- Use the Dashboard for apps directed towards children under 13: In cases where it is clear that your app is primarily directed to children under the age of 13, use the COPPA settings section in the Publisher Dashboard instead of the SDK COPPA API.
- Conflicting settings between API and Dashboard: As noted above, you can establish COPPA settings at the app level (but not at the user level) on the Publisher Dashboard, and at the device/user level by using the SDK COPPA API. Under the current release of SDK COPPA API functionality, in the event of a conflict between the settings in Publisher Dashboard and those passed via the SDK COPPA API, the COPPA-compliant setting takes precedence.
For example, if your app setting on the Publisher Dashboard is COPPA-compliant, and that same app also enables use of the SDK COPPA API and identifies a given user as over 13, Vungle will defer to the Dashboard setting, which states that all the users in this app are protected by COPPA regulations. If, on the other hand, your app setting on the Publisher Dashboard states that your app is not directed toward users under the age of 13, but a call to the SDK COPPA API identifies a given user as under age 13, Vungle will override the dashboard setting and treat that user as being protected by COPPA regulations.
COPPA API
The SDK COPPA API must be called before calling the init method. To update Vungle about a user’s COPPA status:
/**
* This method can be used to provide a user's COPPA status to the Vungle SDK.
* This method should be called before initialization.
*/
AdFactory.UpdateCoppaStatus(bool value)- Use
AdFactory.UpdateCoppaStatus(bool value)whereB=VALUEis set to `true` for a user who is under the age of 13 and falls under COPPA regulations; `false` for a user known to be over the age of 13. - Then call
AdFactory.GetInstance(), as shown.
Usage example:
// To treat the user as under age 13
// and under COPPA regulations:
AdFactory.UpdateCoppaStatus(true)
// OR
// If user is known to be over age 13 and
// does NOT fall under COPPA regulations:
AdFactory.UpdateCoppaStatus(false)
// Initialize SDK after setting COPPA Status
VungleAd sdkInstance;
string appId = “VUNGLE_APP_ID”;
sdkInstance = AdFactory.GetInstance(appId);
Create a VungleSDKConfig object and add it as a parameter in your 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. We recommend that you contact Liftoff support before using any of these features. There are also additional properties not listed below, which can be set in VungleSDKConfig, but these should only be used when requested by a Liftoff support person.
sdkConfig.DisableAshwidTracking = true;
sdkConfig.MinimumDiskSpaceForAd = 50 * 1024 * 1024;
sdkConfig.MinimumDiskSpaceForInit = 50 * 1024 * 1024;These are the available properties in the AdConfig object instance.
| Options |
Default Value/ Type |
Description |
|---|---|---|
Orientation |
AutoRotate DisplayOrientations |
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. |
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. |
The options for SoundEnabled and incentivized dialogs for Dynamic Template ads are available on the dashboard to configure. Programmatic configuration will only apply to legacy ads.
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 Liftoff Monetize Dashboard.
As of May 25, 2019, the General Data Protection Regulation (GDPR) is enforced in the European Union. To comply with GDPR, developers have two options.
- Option 1 (recommended): Allow Vungle to handle the requirements. Vungle will display a consent dialog before playing an ad for a European user, and will remember the user’s consent or rejection for subsequent ads.
- Option 2: Publisher controls the GDPR consent process at the user level, then communicates the user’s choice to Vungle. To do this, developers can collect the user’s consent using their own mechanism, and then use Vungle APIs to update or query the user’s consent status. Refer to the sample code below for details.
// To set the user’s consent status as opted in to version 1.0 of your consent dialog:
sdkInstance.UpdateConsentStatus(VungleConsentStatus.VungleConsentAccepted,"1.0");
// To set the user’s consent status as opted out of version 2.0 of your consent dialog:
sdkInstance.UpdateConsentStatus(VungleConsentStatus.VungleConsentDenied,"2.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 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 Vungle SDK v6.2 or lower, set the consent status as follows:
// To set the user’s consent status on SDK versions 6.2 and below:
sdkInstance.UpdateConsentStatus(VungleConsentStatus.VungleConsentAccepted);