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.
Liftoff has tools to assist publishers with COPPA compliance. In addition to the settings on the Monetize Dashboard, Liftoff offers features within the Vungle SDK using the COPPA API.
- Android - Upgrade to Vungle Unity plugin v.6.10.6.2 or above as the most direct way to comply with Google’s Privacy Policy
- iOS - Upgrade to Vungle Unity plugin v6.11.0.0
To learn more about Vungle's tools to assist publishers in complying with COPPA, as well as when to use the SDK COPPA API as opposed to the Dashboard COPPA settings, refer to our COPPA Implementation details.
COPPA API
The SDK COPPA API must be called before calling the init
method.
To update Vungle about a user’s COPPA status:
- Use
Vungle.updateCoppaStatus
to set theisUserCoppa
parameter 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
Vungle.init
, as shown.
/**
* Use to update Vungle on a user’s COPPA status. Indicate ‘true’ if user is known to fall under COPPA regulations.
* Call this before initialization the Vungle SDK
*
* i.e.,
* Vungle.updateCoppaStatus(true)
* Vungle.init(...)
*
* @param isUserCoppa - ‘true’ if user is known to be 13 and under to comply with COPPA regulations
*/
public static void updateCoppaStatus(boolean isUserCoppa)
Usage example:
// To treat the user as under age 13
// and under COPPA regulations:
Vungle.updateCoppaStatus(true);
OR
// If user is known to be over age 13 and
// does NOT fall under COPPA regulations:
Vungle.updateCoppaStatus(false);
// Initialize SDK after setting COPPA Status
Vungle.init(APP_ID);
Starting with Vungle SDK v6.10.3, Vungle supports app set ID. To take advantage of this feature, include these Google Play Services dependencies using the custom Gradle template:
implementation 'com.google.android.gms:play-services-tasks:17.2.1'
implementation 'com.google.android.gms:play-services-appset:16.0.0'
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.updateCCPAStatus(Vungle.Consent.Denied);
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
|
|||||||||||||||||||||||||||
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:
Vungle.setSoundEnabled(false);
Vungle.setSoundEnabled(true);
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
Vungle.setSoundEnabled(false);
DebugLog("Is sound enabled:" + Vungle.isSoundEnabled()); //Vungle.isSoundEnabled should return false
Vungle.setSoundEnabled(true);
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).
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 out
Vungle.EnableHardwareIdPrivacy(m_disableHardwareID);
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();