Advanced Settings

Begin by following the instructions in the basic plugin integration article, and then the instructions for any of the ad formats you want to integrate (interstitial or rewarded ads, banner or MREC ads). This article contains supplementary information and assumes you have completed basic integration.

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) {
    else {

CCPA Implementation

As of July 1, 2020, the California Consumer Privacy Act (CCPA) will be enforced, and to comply with CCPA, publishers must update to Vungle Unity Plugin v6.7.0.0.

Use updateCCPAStatus to set the user’s consent status to specify that the user has opted out by passing Consent.DENIED. Use getCCPAStatus to get the current CCPA status for a specific user.

public static void updateCCPAStatus(Consent consent)
public static Consent getConsentStatus()

Sample Code

Vungle.Consent CurrentCCPAStatus = Vungle.getCCPAStatus();

Ad Configuration 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: Rewarded ads are in some cases referred to as incentivized ads; 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
  • UseVungleAdOrientation enum to specify desired orientation in Integer
    public enum VungleAdOrientation
        Portrait = 1,
        LandscapeLeft = 2,
        LandscapeRight = 3,
        PortraitUpsideDown = 4,
        Landscape = 5,
        All = 6,
        AllButUpsideDown = 7
    VungleAdOrientation Value Orientation Supported Platform
    1 Portrait iOS, Android, Windows
    2 LandscapeLeft iOS
    3 LandscapeRight iOS
    4 PortraitUpsideDown iOS
    5 Landscape iOS, Android, Windows
    6 All iOS, Android, Windows
    7 AllButUpsideDown iOS
    8 MatchVideo Android
  • For v6.7.2.1 and below, Android and Windows take true or false for orientation, which still works as of v6.8.0.0, but planned to be deprecated in the future.
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.

The setSoundEnabled method allows user to start an interstitial, rewarded, or MREC ad to be muted or unmuted by setting isEnabled to false and true respectively,

public static void setSoundEnabled(bool isEnabled); //isEnabled is true by default

Sample code:


As of 6.9.1 for IOS and Android, the Unity plugin also includes Vungle.isSoundEnabled method to check the value of Vungle.setSoundEnabled.  

Sample code: 

//The default value of Vungle.isSoundEnabled() is true

DebugLog("Is sound enabled:" + Vungle.isSoundEnabled()); //Vungle.isSoundEnabled should return false

DebugLog("Is sound enabled:" + Vungle.isSoundEnabled()); //Vungle.isSoundEnabled should return true.


Minimum Disk Space

Minimum disk space configuration was introduced in version 6.4.0 to determine the limits for available space on a user’s 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).


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 out

GDPR Recommended Implementation Instructions

As of May 25, 2019, the General Data Protection Regulation (GDPR) will be 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 use Vungle APIs to update or query the user’s consent status as recommended in Option 1, use the Vungle.Consent enumerator and set the current value with the following 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();
Powered by Creativity Driven by Performance Sign Up Here


Need further assistance, feel free to reach out to us, we’re here to help!

Was this article helpful?