Data Passing

The RTB-Stack SDK offers publishers the capability to pass data related to their content and users to enhance ad targeting and relevance. This is achieved through specific classes and methods designed to handle JSON objects conforming to the IAB OpenRTB Specification ver.2.6.

Relevant Classes and Method:

The data passing functionality can be utilized in the following classes:

  • BannerAdView
  • InterstitialAdView
  • RewardedAdView

Method to Use:

setOrtbObject(JSONObject ortbObject)

Description:

This method sets a JSON object containing content and user-related data.

Parameters:

  • ortbObject: A JSON Object built according to the IAB OpenRTB Specification ver.2.6.

Data Structure:

  • Under the 'app' key, include an object with application data.
  • Under the 'user' key, include an object with user data.

Supported Values:

  • For 'app'catsectioncatpagecatpublishercontent.
  • For 'user'keywords.

Example Usage:

Here's how to implement the method in your code:

String ortbStr = "YOUR_ORTB_OBJECT";
JSONObject ortbJson = new JSONObject(ortbStr);
bannerAdView.setOrtbObject(jsonOrtb);

JSON Data Example:

Below is an example of how the JSON data should be structured:

{
   "app":{
      "cat":[
         "IAB15",
         "IAB15-10"
      ],
      "content":{
         "id":"123",
         "episode":1,
         "title":"Weather in Seattle"
      }
   },
   "user":{
      "keywords":"cars, sports"
   }
}
Updated on November 01, 2024