You can use the setExtras
and getExtras
API to pass and retrieve the information. To set the data, follow the instructions below:
To help publishers comply with the California Consumer Privacy Act (CCPA), the Meson SDK allows publishers to use either of the following parameters to enable restricted data processing (RDP).
Key | Data Type | Value |
---|---|---|
rdp |
Boolean | Set this to true or false for signaling restricted data processing. |
iab_usprivacy_string |
String | Follow the IAB specification for signaling restricted data processing. |
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")
}
MesonSdk.setExtras(extras)
}
// You can notify Meson that restricted data processing is enabled using either of the following parameters.
public void setExtras() {
JSONObject extras = new JSONObject();
extras.put("rdp", false);
extras.put("iab_usprivacy_string", "1YNN");
MesonSdk.Companion.setExtras(extras);
}
To use cohorts in Meson UI, this is where you will need to set a PPID unique to a user
To use segments or experiments in Meson UI, this is where you will need to send the segments or experiments.
This is optional. In case you want to send us any information about the user, follow the instructions to set the user data:
Key | Data Type | Value |
---|---|---|
Gender | Int |
BaseMesonInit.GENDER.MALE.value |
Age | Int | Age of the user |
Segments | Array<String> |
[“engaged_user”, “binge_user”, “gold_tier_dau”] |
Experiments | Array<String> |
[“high_churn_user”, “no_ads_user”, “ltv_user”] |
Interests | String | User interest area |
private fun setExtras() {
//Set Extras
val extras = JSONObject()
extras.run {
put("age", 18)
put("gender", BaseMesonInit.GENDER.MALE.value)
put("segments", JSONArray(listOf("engaged_user", "binge_user", "gold_tier_dau")))
put("experiments", JSONArray(listOf("high_churn_user", "no_ads_user", "ltv_user")))
}
MesonSdk.setExtras(extras)
}
private void setExtras() {
//Set Extras
JSONObject extras = new JSONObject();
extras.put("age", 18);
extras.put("gender", BaseMesonInit.GENDER.MALE.getValue());
extras.put("interests", "interests");
extras.put("segments", new JSONArray(Arrays.asList("s1", "s2", "s3")));
extras.put("experiments", new JSONArray(Arrays.asList("e1", "e2", "e3")));
MesonSdk.Companion.setExtras(extras);
}
To use cohorts on the Meson UI, you must set the PPID unique to a user.
private fun setExtras() {
// Set PPID - (Unique Identifier for each user)
MesonSdk.setPPID("adada134412y1876dad")
}
private void setExtras() {
// Set PPID - (Unique Identifier for each user)
MesonSdk.Companion.setPPID("<Your unique user PPID>");
}
If your app collects location from the user, we recommend passing it up, as impressions with location signals have higher revenue potential.
private fun setLocation() {
//Set Location
val location = Location(LocationManager.GPS_PROVIDER)//provider name may be one of [gps, network, passive, fused]
location.latitude = 12.935386622398175//This is a sample co-ordinate, please use your own co-ordinate
location.longitude = 77.69424226118132//This is a sample co-ordinate, please use your own co-ordinate
location.time = System.currentTimeMillis()//provide time when the above location was recorded.
MesonSdk.setLocation(location)
}
private void setLocation() {
//Set Location
Location location = new Location(LocationManager.GPS_PROVIDER);//provider name may be one of [gps, network, passive, fused]
location.setLatitude(12.935386622398175);//This is a sample co-ordinate, please use your own co-ordinate
location.setLongitude(77.69424226118132);//This is a sample co-ordinate, please use your own co-ordinate
location.setTime(System.currentTimeMillis());//provide time when the above location was recorded.
MesonSdk.Companion.setLocation(location);
}
It deletes the data from persistent storage (Location, Extras, PPID, Gender).
MesonSdk.cleanUserInfo()
MesonSdk.Companion.cleanUserInfo();