Skip to content

Pubmatic Adapter: Forward skadn object in bid request #4130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public class PubmaticBidder implements Bidder<BidRequest> {
private static final String BIDDER_NAME = "pubmatic";
private static final String AE = "ae";
private static final String GP_ID = "gpid";
private static final String SKADN = "skadn";
private static final String IMP_EXT_PBADSLOT = "pbadslot";
private static final String IMP_EXT_ADSERVER = "adserver";
private static final List<String> IMP_EXT_DATA_RESERVED_FIELD = List.of(IMP_EXT_PBADSLOT, IMP_EXT_ADSERVER);
Expand Down Expand Up @@ -294,6 +295,9 @@ private ObjectNode makeKeywords(PubmaticBidderImpExt impExt) {
if (impExt.getGpId() != null) {
keywordsNode.put(GP_ID, impExt.getGpId());
}
if (impExt.getSkadn() != null) {
keywordsNode.set(SKADN, impExt.getSkadn());
}

return keywordsNode;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ public class PubmaticBidderImpExt {

@JsonProperty("gpid")
String gpId;

ObjectNode skadn;
}
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ public void makeHttpRequestsShouldAddImpExtAddUnitKeyKeyWordFromDataAdSlotIfAdSe
ExtImpPubmatic.builder().build(),
extData,
null,
null,
null
)))
.build()))
Expand Down Expand Up @@ -577,6 +578,7 @@ public void makeHttpRequestsShouldAddImpExtAddUnitKeyKeyWordFromAdServerAdSlotIf
ExtImpPubmatic.builder().build(),
extData,
null,
null,
null
)))
.build()))
Expand Down Expand Up @@ -611,6 +613,7 @@ public void makeHttpRequestsShouldAddImpExtWithKeyValWithDctrAndExtDataExceptFor
ExtImpPubmatic.builder().dctr("dctr").build(),
extData,
null,
null,
null
)))
.build()))
Expand Down Expand Up @@ -648,6 +651,7 @@ public void makeHttpRequestsShouldAddImpExtWithKeyValWithExtDataWhenDctrIsAbsent
ExtImpPubmatic.builder().dctr(null).build(),
extData,
null,
null,
null
)))
.build()))
Expand Down Expand Up @@ -675,7 +679,7 @@ public void makeHttpRequestsShouldAddImpExtAddAE() {
.id("123")
.banner(Banner.builder().build())
.ext(mapper.valueToTree(PubmaticBidderImpExt.of(
ExtImpPubmatic.builder().build(), null, 1, null)))
ExtImpPubmatic.builder().build(), null, 1, null, null)))
.build()))
.build();

Expand All @@ -700,7 +704,7 @@ public void makeHttpRequestsShouldAddImpExtAddGpId() {
.id("123")
.banner(Banner.builder().build())
.ext(mapper.valueToTree(PubmaticBidderImpExt.of(
ExtImpPubmatic.builder().build(), null, null, "gpId")))
ExtImpPubmatic.builder().build(), null, null, "gpId", null)))
.build()))
.build();

Expand All @@ -717,6 +721,34 @@ public void makeHttpRequestsShouldAddImpExtAddGpId() {
.containsExactly(expectedImpExt);
}

@Test
public void makeHttpRequestsShouldAddImpExtAddSkadn() {
// given
final ObjectNode skadn = mapper.createObjectNode()
.put("field1", 1)
.put("field2", "value");
final BidRequest bidRequest = BidRequest.builder()
.imp(singletonList(Imp.builder()
.id("123")
.banner(Banner.builder().build())
.ext(mapper.valueToTree(PubmaticBidderImpExt.of(
ExtImpPubmatic.builder().build(), null, null, null, skadn)))
.build()))
.build();

// when
final Result<List<HttpRequest<BidRequest>>> result = target.makeHttpRequests(bidRequest);

// then
final ObjectNode expectedImpExt = mapper.createObjectNode().set("skadn", skadn);
assertThat(result.getErrors()).isEmpty();
assertThat(result.getValue())
.extracting(HttpRequest::getPayload)
.flatExtracting(BidRequest::getImp)
.extracting(Imp::getExt)
.containsExactly(expectedImpExt);
}

@Test
public void makeHttpRequestsShouldSetImpExtFromKeywordsSkippingKeysWithEmptyValues() {
// given
Expand Down
Loading