Setup SDK
Create Request
Fetch Recommendations
Setup SDK
Make sure to initiate Outbrain SDK by calling “register()” method with a partner key that is configured specifically for platforms (contact your AM or GTO for more details if needed). See example:
Outbrain.register(this, "DEMOP1MN24J3E1MGLQ92067LH");
Create Request
In order to generate a request for recommendations via the SDK, the app developer should create a new instance of OBPlatformRequest
with the following mandatory params:
- widget id
- bundleUrl or portalUrl
- lang (for example: “en”)
See the constructor signature
public OBPlatformRequest(String widgetId, String bundleUrl, String portalUrl, String lang)
See example
OBPlatformRequest platformRequest = new OBPlatformRequest(OUTBRAIN_SAMPLE_WIDGET_ID, null, OUTBRAIN_SAMPLE_PORTAL_URL, "en");
Optional param – psub
psub
is a property on OBPlatformRequest
which publishers can set for an additional source breakdown available for platforms.
OBNews support
There are 2 params needed for platforms API to support Outbrain News. The params are news
and newsFrom
For example:
news = "IAB1,IAB3,IAB10"
newsFrom=es
newsFrom=es
How to Set?
OBPlatformRequest platformRequest = new OBPlatformRequest("APP_31", null, "https://www.mi.com/", "en");
platformRequest.setNewsFrom("es");
platformRequest.setNews("IAB1,IAB3,IAB10");
Outbrain.fetchRecommendations(platformRequest, this);
Fetch Recommendations
After OBPlatformRequest
is created – the app developer can fetch recommendations by calling:
Outbrain.fetchRecommendations(platformRequest, this);