User Data

Last Updated on: 08 Dec, 2022

You can use the setExtras and getExtras API to pass and retrieve the information. To set the data, follow the instructions below:

  1. Set CCPA through the Restricted Data Processing
  2. Set User Data

Restricted Data Processing

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.

Kotlin

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)
}

Java

// 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);
}

Add User Data

INFO

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
BaseMesonInit.GENDER.FEMALE.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

Kotlin

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)
}

Java

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);

}

Publisher-provided Identifier (PPID)

To use cohorts on the Meson UI, you must set the PPID unique to a user.

Kotlin

private fun setExtras() {
  // Set PPID - (Unique Identifier for each user)
  MesonSdk.setPPID("adada134412y1876dad")
}

Java

private void setExtras() {
  // Set PPID - (Unique Identifier for each user)
  MesonSdk.Companion.setPPID("<Your unique user PPID>");
}

Location

If your app collects location from the user, we recommend passing it up, as impressions with location signals have higher revenue potential.

Kotlin

private fun setLocation() {
        //Set Location
        val location = Location(LocationManager.GPS_PROVIDER);
          location.latitude
          location.longitude
          location.accuracy
          location.time

        MesonSdk.setLocation(location)
    }

Java

//Set Location
  Location location = new Location(LocationManager.GPS_PROVIDER);
    location.setLatitude(12.935386622398175);
    location.setLongitude(77.69424226118132);
    location.setAccuracy(90);
    location.setTime(System.currentTimeMillis());

  MesonSdk.Companion.setLocation(location)

Clean User Data

It deletes the data from persistent storage (Location, Extras, PPID, Gender).

Kotlin

MesonSdk.cleanUserInfo()

Java

MesonSdk.Companion.cleanUserInfo();