Skip to content

Commit

Permalink
Address PR review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
steffenmllr committed Oct 28, 2024
1 parent 2271af3 commit 86cfe94
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import io.vertx.core.Vertx;
import io.vertx.core.http.HttpHeaders;
import io.vertx.core.http.HttpMethod;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.prebid.server.analytics.AnalyticsReporter;
import org.prebid.server.analytics.model.AmpEvent;
Expand Down Expand Up @@ -195,17 +196,19 @@ private static String getPublisherId(BidRequest bidRequest) {

final String publisherId = Optional.ofNullable(site).map(Site::getPublisher).map(Publisher::getId)
.or(() -> Optional.ofNullable(app).map(App::getPublisher).map(Publisher::getId))
.orElse("");
.orElse(null);
final String appSiteId = Optional.ofNullable(site).map(Site::getId)
.or(() -> Optional.ofNullable(app).map(App::getId))
.or(() -> Optional.ofNullable(app).map(App::getBundle))
.orElse(null);

if (publisherId.equals("") && appSiteId == null) {
if (publisherId == null && appSiteId == null) {
return null;
}

return appSiteId != null ? publisherId + "_" + appSiteId : publisherId;
return appSiteId != null
? String.format("%s_%s", StringUtils.defaultString(publisherId, ""), appSiteId)
: publisherId;
}

private void sendEvents(List<String> events) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import lombok.NoArgsConstructor;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.prebid.server.analytics.AnalyticsReporter;
import org.prebid.server.analytics.reporter.AnalyticsReporterDelegator;
import org.prebid.server.analytics.reporter.agma.AgmaAnalyticsReporter;
Expand Down Expand Up @@ -114,8 +115,8 @@ public AgmaAnalyticsProperties toComponentProperties() {
account -> {
final String publisherId = account.getPublisherId();
final String siteAppId = account.getSiteAppId();
return (siteAppId != null && !siteAppId.isEmpty())
? publisherId + "_" + siteAppId
return StringUtils.isNotBlank(siteAppId)
? String.format("%s_%s", publisherId, siteAppId)
: publisherId;
},
AgmaAnalyticsAccountProperties::getCode
Expand Down

0 comments on commit 86cfe94

Please sign in to comment.