Skip to content

Conversation

@mmoschovas
Copy link

@mmoschovas mmoschovas commented Sep 25, 2025

🔧 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.)

✨ What's the context?

What's the context for the changes?
Macro support for IX bid endpoint. Ability to pass accountId to PBS for IX to be autopopulated in endpoint to handle multiople account id scenarios

🧠 Rationale behind the change

Why did you choose to make these changes? Were there any trade-offs you had to consider?
See above

@AntoxaAntoxic
Copy link
Collaborator

AntoxaAntoxic commented Oct 6, 2025

Hi @mmoschovas

Do you have a PR for PBS Go? If yes, please add the link here

Comment on lines +75 to +78
public IxBidder(String endpointUrl,
String defaultAccountId,
PrebidVersionProvider prebidVersionProvider,
JacksonMapper mapper) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

please format the parameters list

Comment on lines +75 to +78
public IxBidder(String endpointUrl,
String defaultAccountId,
PrebidVersionProvider prebidVersionProvider,
JacksonMapper mapper) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

please add an empty line between lines 78 and 79 (according to the repo's code style)

PrebidVersionProvider prebidVersionProvider,
JacksonMapper mapper) {
this.endpointUrl = HttpUtil.validateUrl(Objects.requireNonNull(endpointUrl));
this.defaultAccountId = (defaultAccountId != null) ? defaultAccountId : "";
Copy link
Collaborator

Choose a reason for hiding this comment

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

StringUtils.defaultString(defaultAccountId)

@NotBlank
private String endpoint;

private String defaultAccountId;
Copy link
Collaborator

Choose a reason for hiding this comment

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

this property should be added only for the IX bidder, not for all bidders, please create a custom BidderConfigurationProperties for the IX bidder

please check the SmartadserverConfiguration for inspiration

final String accountId = impExt.getAccountId();
if (StringUtils.isNotEmpty(accountId)) {
accountIds.add(accountId);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

looks like the set of accounts isn't really needed

please replace the final Set<String> accountIds = new HashSet<>(); with the String accountId = null and the following code

                final String accountId = impExt.getAccountId();
                if (StringUtils.isNotEmpty(accountId)) {
                    accountIds.add(accountId);
                }

with the

accountId = accountId == null ? impExt.getAccountId() : accountId;

Comment on lines +117 to +119
final String resolvedAccountId = accountIds.isEmpty()
? null
: accountIds.iterator().next();
Copy link
Collaborator

Choose a reason for hiding this comment

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


private String resolveEndpointMacro(String endpoint, String accountId) {
final String resolvedAccountId = StringUtils.isNotEmpty(accountId) ? accountId : this.defaultAccountId;
return endpoint.replace("${IX_ACCOUNT_ID}", resolvedAccountId);
Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. the macro should have the following pattern {{AccountId}}
  2. please extract the macro name as a constant
  3. I suggest adding this macro to the IX bidder endpoint in the ix.yaml, but since the whole endpoint is absent, it would be nice to provide the example of the endpoint with the macro provided
  4. use the HttpUtil.encode(resolvedAccountId) if the account is a query parameter

Comment on lines +976 to +977
private static ObjectNode givenImpExt(String siteId, String sid, String accountId) {
return mapper.valueToTree(ExtPrebid.of(null, ExtImpIx.of(siteId, null, sid, accountId)));
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's create a separate overloaded givenImpExt without an accountId in order not to pass nulls everywhere

Comment on lines +370 to +374
assertThat(result.getErrors()).isEmpty();
assertThat(result.getValue()).hasSize(1);
assertThat(result.getValue().get(0).getUri())
.doesNotContain("${IX_ACCOUNT_ID}")
.contains(accountId);
Copy link
Collaborator

Choose a reason for hiding this comment

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

please use extracting approach as any other tests in the class

@osulzhenko
Copy link
Collaborator

@mmoschovas any updates?

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