If you are integrating the Meson SDK for the first time, we recommend skipping the Update SDK from Wrap 2.0.4 and below to Wrap 2.0.5 section and proceeding with the remaining integration steps.
Beginning with SDK version 2.0.5, we've enhanced the user signal-gathering process for GDPR and COPPA compliance by consolidating them into a single API. This eliminates the necessity for multiple API calls and offers publishers a centralized solution for comprehensive consent management.
Make sure that you replace the old SDK with the new one.
/GDPR settings from your CMP
val gdprConsent = JSONObject().run {
put(MesonWrap.MES_GDPR_CONSENT_AVAILABLE, true) //consent value that is obtained from User
put(MesonWrap.MES_GDPR_CONSENT_GDPR_APPLIES, "0") //0 if GDPR is not applicable and 1 if applicable
put(MesonWrap.MES_GDPR_CONSENT_IAB, "")//user consent in IAB format
}
//set GDPR Consent via MesonSdkConfiguration.Builder
val mesonSdkConfiguration = MesonSdkConfiguration.Builder(this, "").setConsent(gdprConsent).build()
//CCPA
private fun setExtras() {
// You can notify Meson that restricted data processing is enabled using either of the following parameters.
val extras = JSONObject()
extras.run{
put("rdp", false)
put("iab_usprivacy_string", "1YNN")
}
MesonWrap.setExtras(extras)
}
//GDPR settings from your CMP
JSONObject pubConsent = new JSONObject();
try {
//consent value that is obtained from User
pubConsent.put(MesonWrap.Companion.getMES_GDPR_CONSENT_AVAILABLE(), true);
//0 if GDPR is not applicable and 1 if applicable
pubConsent.put(MesonWrap.Companion.getMES_GDPR_CONSENT_GDPR_APPLIES(), "0");
//user consent in IAB format
pubConsent.put(MesonWrap.Companion.getMES_GDPR_CONSENT_IAB(), "");
} catch (JSONException e) {
e.printStackTrace();
}
//set GDPR Consent via MesonSdkConfiguration.Builder
MesonSdkConfiguration mesonSdkConfiguration = new MesonSdkConfiguration.Builder(getApplicationContext(), "").setConsent(pubConsent).build();
//CCPA
public void setExtras() {
// You can notify Meson that restricted data processing is enabled using either of the following parameters.
JSONObject extras = new JSONObject();
extras.put("rdp", false);
extras.put("iab_usprivacy_string", "1YNN");
MesonWrap.Companion.setExtras(extras);
}
val consent = JSONObject().apply {
//GDPR - You should send the GDPR consent either in a simple format using MesonConstants.CONSENT_GDPR_PUB or in IAB format using MesonConstants.CONSENT_GDPR_CONSENT.
put(MesonConstants.CONSENT_GDPR_PUB, 1)
put(MesonConstants.CONSENT_GDPR, 0)
put(MesonConstants.CONSENT_GDPR_CONSENT, "<IABV1> OR <IABV2>")
//CCPA - You can notify Meson that restricted data processing in a simple format using MesonConstants.CONSENT_DO_NOT_SELL or in IAB format using MesonConstants.CONSENT_US_PRIVACY.
put(MesonConstants.CONSENT_DO_NOT_SELL, false)
put(MesonConstants.CONSENT_US_PRIVACY, "1YNN")
}
MesonWrap.setConsent(consent)
JSONObject consent = null;
try {
consent = new JSONObject()
//GDPR - You should send the GDPR consent either in a simple format using MesonConstants.CONSENT_GDPR_PUB or in IAB format using MesonConstants.CONSENT_GDPR_CONSENT.
.put(MesonConstants.CONSENT_GDPR_PUB, 1)
.put(MesonConstants.CONSENT_GDPR, 0)
.put(MesonConstants.CONSENT_GDPR_CONSENT, "<IABV1> OR <IABV2>")
//CCPA - You can notify Meson that restricted data processing in a simple format using MesonConstants.CONSENT_DO_NOT_SELL or in IAB format using MesonConstants.CONSENT_US_PRIVACY.
.put(MesonConstants.CONSENT_DO_NOT_SELL, false);
.put(MesonConstants.CONSENT_US_PRIVACY, "1YNN")
} catch (JSONException e) {
//handle exception
}
MesonWrap.Companion.setConsent(consent);
MesonSdkConfiguration.Builder
API is substituted with the new MesonWrap.setConsent(consentObject: JSONObject?)
API. If you previously relied on MesonWrap.updateGDPRConsent(consentObject: JSONObject?)
for consent management, we recommend making the switch to the new MesonWrap.setConsent(consentObject: JSONObject?)
API.setExtras
API, which has been changed in the new SDK to be sent via the aforementioned setConsent
API. Delete the older way of sending the CCPA user signals.In the above snippet, the old constants have been replaced with new constants, and the data type of a few values has been changed as follows:
Old Constant | New Constant | Old Value Data Type | New Value Data Type |
---|---|---|---|
MesonWrap.MES_GDPR_CONSENT_AVAILABLE |
MesonConstants.CONSENT_GDPR_PUB |
Boolean | Integer |
MesonWrap.MES_GDPR_CONSENT_IAB |
MesonConstants.CONSENT_GDPR_CONSENT |
No Change | |
MesonWrap.MES_GDPR_CONSENT_GDPR_APPLIES |
MesonConstants.CONSENT_GDPR |
String | Integer |
iab_usprivacy_string |
MesonConstants.CONSENT_US_PRIVACY |
No Change | |
rdp |
MesonConstants.CONSENT_DO_NOT_SELL |
No Change |
MesonWrap.setConsent(consentObject: JSONObject?)
MesonWrap.getConsent()
You can agree or deny the GDPR compliance at the account and app level. For more information about the setup at the account level, see Privacy & Compliance, and for the app level, see Select GDPR and COPPA settings.
If you opt to transmit user signals pertaining to GDPR, Meson Wrap offers a solution to align with GDPR guidelines. With the help of setConsent API, you can conveniently employ the following keys to transmit the corresponding values, thus ensuring compliance with GDPR regulations.
You should send the GDPR consent in a simple format using MesonConstants.CONSENT_GDPR_PUB
or in IAB format using MesonConstants.CONSENT_GDPR_CONSENT
.
Keys | Values | Description |
---|---|---|
MesonConstants.CONSENT_GDPR_PUB |
0 or 1 (Integer) | 0 - Denied. 1 - consented Any other value - Considered Denied. |
MesonConstants.CONSENT_GDPR |
0 or 1 (Integer) | 0 - GDPR applies in this region. 1 - GDPR does not apply. |
MesonConstants.CONSENT_GDPR_CONSENT |
“ConsentString in V1 format“ (String) OR “ConsentString in V2 format“ (String) | For more information, see IAB specification. Note: If any CMP is used to collect info, SDK reads that info from shared preferences. |
You can choose to restrict data processing at an App level. For more information, see Select GDPR and COPPA settings.
If you opt to transmit user signals concerning CCPA, Meson Wrap facilitates compliance with the California Consumer Privacy Act (CCPA).
Meson Wrap allows you to employ either of the following keys through the setConsent API to effortlessly enable or disable restricted data processing (RDP), aligning with CCPA regulations.
Keys | Values | Description |
---|---|---|
MesonConstants.CONSENT_US_PRIVACY |
“1YNN“ (String) For demo purposes only |
For more information on signaling restricted data processing, see IAB specification. Any other value - Considered Denied. |
MesonConstants.CONSENT_DO_NOT_SETLL |
True or false (Boolean) | True - user opted out of the sale of his or her personal information. False - Do Not restrict the processing of user data. |
After configuring GDPR and COPPA settings, the final snippet will resemble the example provided below:
val consent = JSONObject().apply {
//GDPR - You should send the GDPR consent either in a simple format using MesonConstants.CONSENT_GDPR_PUB or in IAB format using MesonConstants.CONSENT_GDPR_CONSENT.
put(MesonConstants.CONSENT_GDPR_PUB, 1)
put(MesonConstants.CONSENT_GDPR, 0)
put(MesonConstants.CONSENT_GDPR_CONSENT, " OR ")
//CCPA - You can notify Meson that restricted data processing in a simple format using MesonConstants.CONSENT_DO_NOT_SELL or in IAB format using MesonConstants.CONSENT_US_PRIVACY.
put(MesonConstants.CONSENT_DO_NOT_SELL, false)
put(MesonConstants.CONSENT_US_PRIVACY, "1YNN")
}
MesonWrap.setConsent(consent)
JSONObject consent = null;
try {
consent = new JSONObject()
//GDPR - You should send the GDPR consent either in a simple format using MesonConstants.CONSENT_GDPR_PUB or in IAB format using MesonConstants.CONSENT_GDPR_CONSENT.
.put(MesonConstants.CONSENT_GDPR_PUB, 1)
.put(MesonConstants.CONSENT_GDPR, 0)
.put(MesonConstants.CONSENT_GDPR_CONSENT, "<iabv1> OR <iabv2>")
//CCPA - You can notify Meson that restricted data processing in a simple format using MesonConstants.CONSENT_DO_NOT_SELL or in IAB format using MesonConstants.CONSENT_US_PRIVACY.
.put(MesonConstants.CONSENT_DO_NOT_SELL, false);
.put(MesonConstants.CONSENT_US_PRIVACY, "1YNN")
} catch (JSONException e) {
//handle exception
}
MesonWrap.Companion.setConsent(consent);
To access consent signals at any point in time, employ the following code snippet:
val consent = MesonWrap.getConsent()
JSONObject consent = MesonWrap.Companion.getConsent();