prebid / prebid-mobile-android

Prebid Mobile SDK for Android applications
Apache License 2.0
58 stars 84 forks source link

`adUnit.ortbConfig` can not customize OpenRTB objects like `/imp[].video.api` #801

Open takenorim opened 2 months ago

takenorim commented 2 months ago

Describe the bug Unlike GAM oringial integration API (e.g. VideoParameters.java), other integration types (e.g. AdMob integration) does not provide basic setter methods (e.g. setApi) to customize OpenRTB params.

I can customize some of OpenRTB objects (e.g. /bidfloor, /app.content.cat) via adUnit.ortbConfig. However, I have difficulty to customize any OpenRTB objects inside the /imp[] array (e.g. /imp[].video.api, /imp[].video.protocols, etc).

To Reproduce Based on the demo app AdMobVideoInterstitialActivity.kt, I tried to use the adUnit.ortbConfig to add /imp[0].video.api: [5,6,7], but all of them does not work as I expected. See Additional context section below for more detail.

Expected behavior There should be a method to customize OpenRTB objects like /imp[].video.api, /imp[].video.mimes, /imp[].banner.pos and so on for generic integration types.

Additional context Testing adUnit.ortbConfig as below.

  1. adUnit?.ortbConfig = "{\"imp\":[{\"video\":{\"api\":[5,6,7]}}]}" Then, POST payload to Prebid Server is below.

    {
    "imp": [
    {
      "id": "ede891f1-4f70-4ce4-b26c-91844397d3c5",
      "displaymanager": "prebid-mobile",
      "displaymanagerver": "2.2.3",
      "instl": 0,
      "clickbrowser": 0,
      "video": {
        "mimes": [
          "video/mp4",
          "video/3gpp",
          "video/webm",
          "video/mkv"
        ],
        "playbackend": 2,
        "protocols": [
          2,
          5
        ],
        "w": 393,
        "h": 759,
        "linearity": 1,
        "placement": 5,
        "delivery": [
          3
        ],
        "pos": 7
      },
      "ext": {
        "prebid": {
          "storedrequest": {
            "id": "prebid-demo-video-interstitial-320-480"
          }
        }
      }
    },
    {
      "video": {
        "api": [
          5,
          6,
          7
        ]
      }
    }
    ],
    "id": "ede891f1-4f70-4ce4-b26c-91844397d3c5",
    "app": {
    "name": "Prebid Kotlin Demo",
    "bundle": "org.prebid.mobile.prebidkotlindemo",
    "ver": "1.0.0",
    "publisher": {
      "id": "0689a263-318d-448b-a3d4-b02e8a709d9d"
    },
    "ext": {
      "prebid": {
        "source": "prebid-mobile",
        "version": "2.2.3"
      }
    }
    },
    "device": {
    "ua": "Mozilla/5.0 (Linux; Android 14; sdk_gphone64_arm64 Build/UE1A.230829.036.A1; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/113.0.5672.136 Mobile Safari/537.36",
    "lmt": 0,
    "devicetype": 4,
    "make": "Google",
    "model": "sdk_gphone64_arm64",
    "os": "Android",
    "osv": "14",
    "hwv": "Google sdk_gphone64_arm64",
    "language": "en",
    "ifa": "1336c7ac-2b2e-490c-9cae-10ca1ad1abe1",
    "h": 2220,
    "w": 1080,
    "connectiontype": 2,
    "pxratio": 2.75
    },
    "regs": {
    "ext": {
      "gdpr": 1
    }
    },
    "user": {},
    "source": {
    "tid": "ede891f1-4f70-4ce4-b26c-91844397d3c5",
    "ext": {
      "omidpv": "2.2.3",
      "omidpn": "Prebid"
    }
    },
    "ext": {
    "prebid": {
      "storedrequest": {
        "id": "0689a263-318d-448b-a3d4-b02e8a709d9d"
      },
      "targeting": {}
    }
    }
    }
  2. adUnit?.ortbConfig = "{\"imp\":{\"video\":{\"api\":[5,6,7]}}}" Then, POST payload (omit irrelevant objects like /app, device) to Prebid Server is below.

    {
    "imp": [
    {
      "id": "bea60f7c-259f-408a-bf28-ecd390ae83b2",
      "displaymanager": "prebid-mobile",
      "displaymanagerver": "2.2.3",
      "instl": 0,
      "clickbrowser": 0,
      "video": {
        "mimes": [
          "video/mp4",
          "video/3gpp",
          "video/webm",
          "video/mkv"
        ],
        "playbackend": 2,
        "protocols": [
          2,
          5
        ],
        "w": 393,
        "h": 759,
        "linearity": 1,
        "placement": 5,
        "delivery": [
          3
        ],
        "pos": 7
      },
      "ext": {
        "prebid": {
          "storedrequest": {
            "id": "prebid-demo-video-interstitial-320-480"
          }
        }
      }
    }
    ],
    "id": "bea60f7c-259f-408a-bf28-ecd390ae83b2",
    ...(snip)...
    }
  3. adUnit?.ortbConfig = "{\"imp[0]\": {\"video\":{\"api\":[5,6,7]}}}" Then, POST payload (omit irrelevant objects like /app, device) to Prebid Server is below.

    {
    "imp": [
    {
      "id": "acc228ac-7e5e-4e08-89ef-f03b7a6f28bf",
      "displaymanager": "prebid-mobile",
      "displaymanagerver": "2.2.3",
      "instl": 0,
      "clickbrowser": 0,
      "video": {
        "mimes": [
          "video/mp4",
          "video/3gpp",
          "video/webm",
          "video/mkv"
        ],
        "playbackend": 2,
        "protocols": [
          2,
          5
        ],
        "w": 393,
        "h": 759,
        "linearity": 1,
        "placement": 5,
        "delivery": [
          3
        ],
        "pos": 7
      },
      "ext": {
        "prebid": {
          "storedrequest": {
            "id": "prebid-demo-video-interstitial-320-480"
          }
        }
      }
    }
    ],
    "id": "acc228ac-7e5e-4e08-89ef-f03b7a6f28bf",
    
    ...(snip)...
    
    "imp[0]": {
    "video": {
      "api": [
        5,
        6,
        7
      ]
    }
    }
    }
  4. adUnit?.ortbConfig = "{imp[0].video.api=[5,6,7]}" Then, POST payload (omit irrelevant objects like /app, device) to Prebid Server is below.

    {
    "imp": [
    {
      "id": "8614a9a5-0cd3-455e-8f79-b710b243f6cd",
      "displaymanager": "prebid-mobile",
      "displaymanagerver": "2.2.3",
      "instl": 0,
      "clickbrowser": 0,
      "video": {
        "mimes": [
          "video/mp4",
          "video/3gpp",
          "video/webm",
          "video/mkv"
        ],
        "playbackend": 2,
        "protocols": [
          2,
          5
        ],
        "w": 393,
        "h": 759,
        "linearity": 1,
        "placement": 5,
        "delivery": [
          3
        ],
        "pos": 7
      },
      "ext": {
        "prebid": {
          "storedrequest": {
            "id": "prebid-demo-video-interstitial-320-480"
          }
        }
      }
    }
    ],
    "id": "8614a9a5-0cd3-455e-8f79-b710b243f6cd",
    ...(snip)...
    }