Skip to content

Commit ee640d3

Browse files
committed
fallback to RTD maxmind to get country
1 parent e23fb55 commit ee640d3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/core/GreenbidsInferenceDataService.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import com.fasterxml.jackson.databind.node.ObjectNode;
77
import com.iab.openrtb.request.BidRequest;
88
import com.iab.openrtb.request.Device;
9+
import com.iab.openrtb.request.Geo;
910
import com.iab.openrtb.request.Imp;
1011
import com.maxmind.geoip2.DatabaseReader;
1112
import com.maxmind.geoip2.exception.GeoIp2Exception;
@@ -86,12 +87,16 @@ private List<ThrottlingMessage> extractMessagesForImp(
8687
final String ip = Optional.ofNullable(bidRequest.getDevice())
8788
.map(Device::getIp)
8889
.orElse(null);
89-
final String countryFromIp = getCountry(ip);
90+
final String country = Optional.ofNullable(bidRequest.getDevice())
91+
.map(Device::getGeo)
92+
.map(Geo::getCountry)
93+
.orElse(getCountry(ip));
94+
9095
return createThrottlingMessages(
9196
bidderNode,
9297
impId,
9398
greenbidsUserAgent,
94-
countryFromIp,
99+
country,
95100
hostname,
96101
hourBucket,
97102
minuteQuadrant);

0 commit comments

Comments
 (0)