Skip to content

Commit 569a3d1

Browse files
vzhukovskymatthewlane
authored andcommitted
Added dynamic ttl property for One Display and One Mobile. (#2004)
1 parent 46dfc43 commit 569a3d1

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

modules/aolBidAdapter.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ const MP_SERVER_MAP = {
3939
as: 'adserver-as.adtech.advertising.com'
4040
};
4141
const NEXAGE_SERVER = 'hb.nexage.com';
42-
const BID_RESPONSE_TTL = 300;
42+
const ONE_DISPLAY_TTL = 60;
43+
const ONE_MOBILE_TTL = 3600;
4344

4445
$$PREBID_GLOBAL$$.aolGlobals = {
4546
pixelsDropped: false
@@ -224,7 +225,7 @@ function _parseBidResponse(response, bidRequest) {
224225
currency: response.cur,
225226
dealId: bidData.dealid,
226227
netRevenue: true,
227-
ttl: BID_RESPONSE_TTL
228+
ttl: bidRequest.ttl
228229
};
229230
}
230231

@@ -274,21 +275,24 @@ function formatBidRequest(endpointCode, bid) {
274275
case AOL_ENDPOINTS.DISPLAY.GET:
275276
bidRequest = {
276277
url: _buildMarketplaceUrl(bid),
277-
method: 'GET'
278+
method: 'GET',
279+
ttl: ONE_DISPLAY_TTL
278280
};
279281
break;
280282

281283
case AOL_ENDPOINTS.MOBILE.GET:
282284
bidRequest = {
283285
url: _buildOneMobileGetUrl(bid),
284-
method: 'GET'
286+
method: 'GET',
287+
ttl: ONE_MOBILE_TTL
285288
};
286289
break;
287290

288291
case AOL_ENDPOINTS.MOBILE.POST:
289292
bidRequest = {
290293
url: _buildOneMobileBaseUrl(bid),
291294
method: 'POST',
295+
ttl: ONE_MOBILE_TTL,
292296
data: bid.params,
293297
options: {
294298
contentType: 'application/json',

test/spec/modules/aolBidAdapter_spec.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,10 @@ let getPixels = () => {
7474
};
7575

7676
describe('AolAdapter', () => {
77-
const MARKETPLACE_URL = 'adserver-us.adtech.advertising.com/pubapi/3.0/';
78-
const NEXAGE_URL = 'hb.nexage.com/bidRequest?';
77+
const MARKETPLACE_URL = '//adserver-us.adtech.advertising.com/pubapi/3.0/';
78+
const NEXAGE_URL = '//hb.nexage.com/bidRequest?';
79+
const ONE_DISPLAY_TTL = 60;
80+
const ONE_MOBILE_TTL = 3600;
7981

8082
function createCustomBidRequest({bids, params} = {}) {
8183
var bidderRequest = getDefaultBidRequest();
@@ -98,7 +100,8 @@ describe('AolAdapter', () => {
98100
bidderSettingsBackup = $$PREBID_GLOBAL$$.bidderSettings;
99101
bidRequest = {
100102
bidderCode: 'test-bidder-code',
101-
bidId: 'bid-id'
103+
bidId: 'bid-id',
104+
ttl: 1234
102105
};
103106
bidResponse = {
104107
body: getDefaultBidResponse()
@@ -125,7 +128,7 @@ describe('AolAdapter', () => {
125128
currency: 'USD',
126129
dealId: 'deal-id',
127130
netRevenue: true,
128-
ttl: 300
131+
ttl: bidRequest.ttl
129132
});
130133
});
131134

@@ -355,6 +358,13 @@ describe('AolAdapter', () => {
355358
let [request] = spec.buildRequests(bidRequest.bids);
356359
expect(request.url).to.contain('kvage=25;kvheight=3.42;kvtest=key');
357360
});
361+
362+
it('should return request object for One Display when configuration is present', () => {
363+
let bidRequest = getDefaultBidRequest();
364+
let [request] = spec.buildRequests(bidRequest.bids);
365+
expect(request.method).to.equal('GET');
366+
expect(request.ttl).to.equal(ONE_DISPLAY_TTL);
367+
});
358368
});
359369

360370
describe('One Mobile', () => {
@@ -454,6 +464,7 @@ describe('AolAdapter', () => {
454464
let [request] = spec.buildRequests(bidRequest.bids);
455465
expect(request.url).to.contain(NEXAGE_URL);
456466
expect(request.method).to.equal('POST');
467+
expect(request.ttl).to.equal(ONE_MOBILE_TTL);
457468
expect(request.data).to.deep.equal(bidConfig);
458469
expect(request.options).to.deep.equal({
459470
contentType: 'application/json',

0 commit comments

Comments
 (0)