Skip to content

ConnectAd: Add video, native and audio support - #4506

Open
rtuschkany wants to merge 7 commits into
prebid:masterfrom
rtuschkany:master
Open

ConnectAd: Add video, native and audio support#4506
rtuschkany wants to merge 7 commits into
prebid:masterfrom
rtuschkany:master

Conversation

@rtuschkany

Copy link
Copy Markdown

…ropagate network/site IDs in imp extension

🔧 Type of changes

  • new bid adapter
  • bid adapter update
  • new feature
  • new analytics adapter
  • new module
  • module update
  • bugfix
  • documentation
  • configuration
  • dependency update
  • tech debt (test coverage, refactorings, etc.)

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment on lines +62 to +64
if (imp.getBanner() == null && imp.getVideo() == null && imp.getXNative() == null && imp.getAudio() == null) {
throw new PreBidException("We need a Banner, Video, Native or Audio Object in the request");
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for this validation

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^^

Comment thread src/main/java/org/prebid/server/bidder/connectad/ConnectAdBidder.java Outdated
.build();
}

private ObjectNode modifyImpExt(ObjectNode impExt, ExtImpConnectAd extImpConnectAd) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reorder methods, so they are in call order

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^^

}

private ObjectNode modifyImpExt(ObjectNode impExt, ExtImpConnectAd extImpConnectAd) {
final ObjectNode modifiedExt = impExt != null ? impExt.deepCopy() : mapper.mapper().createObjectNode();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

impExt can't be null

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^^

Comment on lines +124 to +141
if (networkId != null) {
try {
modifiedExt.put("networkId", Integer.parseInt(networkId));
} catch (NumberFormatException e) {
modifiedExt.put("networkId", networkId);
}
}

if (siteId != null) {
try {
modifiedExt.put("siteId", Integer.parseInt(siteId));
} catch (NumberFormatException e) {
modifiedExt.put("siteId", siteId);
}
}

return modifiedExt;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need this? This fields already present in initial impExt

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I asked the question is the following (connectad.json):

    "networkId": {
      "type": [
        "integer",
        "string"
      ]
    },
    "siteId": {
      "type": [
        "integer",
        "string"
      ],

If you want to transfer data in the format it originally came in, then simply copy it from impExt.get("bidder").get("networkId/siteId"). Furthermore, your implementation differs from the GO implementation. GO only accepts parsable integers (see StringInt). You can change ExtImpConnectAd that way:

@Value(staticConstructor = "of")
public class ExtImpConnectAd {

    @JsonProperty("networkId")
    Integer networkId;

    @JsonProperty("siteId")
    Integer siteId;

    @JsonProperty("bidfloor")
    BigDecimal bidFloor;
}

- Remove unnecessary null check on bidRequest in getBidType() method
- Remove unnecessary empty check on bidRequest.getImp() in getBidType() method
- Reorder modifyImpExt() method to be between updateImp() and updateBanner() 
  for better code organization and readability
- Add comprehensive JavaDoc comments explaining:
  - Why media type validation is necessary and validates all media types
  - Why networkId and siteId must be propagated to root level of imp.ext
  - Why getBidType() can safely assume bidRequest is non-null
- Keep defensive null check on impExt parameter for robustness (as per review discussion)

These changes address feedback from code review while maintaining code quality 
and robustness.

Addresses review comments from PR prebid#4506
@CTMBNara

CTMBNara commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Remove all the comments you have added

Addresses review feedback on PR prebid#4506 to remove newly added comments.

Co-authored-by: rtuschkany <rtuschkany@users.noreply.github.com>
Comment on lines +62 to +64
if (imp.getBanner() == null && imp.getVideo() == null && imp.getXNative() == null && imp.getAudio() == null) {
throw new PreBidException("We need a Banner, Video, Native or Audio Object in the request");
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^^

}

private ObjectNode modifyImpExt(ObjectNode impExt, ExtImpConnectAd extImpConnectAd) {
final ObjectNode modifiedExt = impExt != null ? impExt.deepCopy() : mapper.mapper().createObjectNode();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^^

.build();
}

private ObjectNode modifyImpExt(ObjectNode impExt, ExtImpConnectAd extImpConnectAd) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^^

Comment on lines +124 to +141
if (networkId != null) {
try {
modifiedExt.put("networkId", Integer.parseInt(networkId));
} catch (NumberFormatException e) {
modifiedExt.put("networkId", networkId);
}
}

if (siteId != null) {
try {
modifiedExt.put("siteId", Integer.parseInt(siteId));
} catch (NumberFormatException e) {
modifiedExt.put("siteId", siteId);
}
}

return modifiedExt;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I asked the question is the following (connectad.json):

    "networkId": {
      "type": [
        "integer",
        "string"
      ]
    },
    "siteId": {
      "type": [
        "integer",
        "string"
      ],

If you want to transfer data in the format it originally came in, then simply copy it from impExt.get("bidder").get("networkId/siteId"). Furthermore, your implementation differs from the GO implementation. GO only accepts parsable integers (see StringInt). You can change ExtImpConnectAd that way:

@Value(staticConstructor = "of")
public class ExtImpConnectAd {

    @JsonProperty("networkId")
    Integer networkId;

    @JsonProperty("siteId")
    Integer siteId;

    @JsonProperty("bidfloor")
    BigDecimal bidFloor;
}

Comment thread src/main/resources/bidder-config/connectad.yaml
@CTMBNara CTMBNara changed the title feat: support video, native, and audio media types in ConnectAd Adapter ConnectAd: Add video, native and audio support Aug 19, 2026
- Remove media type validation and related test
- Use Integer types in ExtImpConnectAd aligned with Go StringInt
- Copy networkId/siteId from imp.ext.bidder preserving original format
- Drop impExt null fallback; reorder methods in call order
- Add ortb-version 2.6 and HTTPS endpoint in connectad.yaml
- Update integration test expectations for ORTB 2.6 and ext copy

Co-authored-by: rtuschkany <rtuschkany@connectad.io>
@rtuschkany

Copy link
Copy Markdown
Author

@CTMBNara Addressed all review points in the latest commit. Happy to re-review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants