From bdf3cfe1efbb68225cb27feb48a882a50452386c Mon Sep 17 00:00:00 2001 From: Jason Piros Date: Thu, 6 Jun 2024 06:53:28 -0600 Subject: [PATCH 1/3] consumableBidAdapter: add language param --- modules/consumableBidAdapter.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/consumableBidAdapter.js b/modules/consumableBidAdapter.js index 30b081e53d3..12c96082ad5 100644 --- a/modules/consumableBidAdapter.js +++ b/modules/consumableBidAdapter.js @@ -61,7 +61,8 @@ export const spec = { source: [{ 'name': 'prebidjs', 'version': '$prebid.version$' - }] + }], + lang: (navigator && navigator.language) ? navigator.language.split('-')[0] : '' }, validBidRequests[0].params); if (bidderRequest && bidderRequest.gdprConsent) { From fa68d2e4e811d6efc72d4ec75c3cbc19eb5f8642 Mon Sep 17 00:00:00 2001 From: Jason Piros Date: Thu, 6 Jun 2024 07:18:12 -0600 Subject: [PATCH 2/3] consumableBidAdapter: add language param test --- test/spec/modules/consumableBidAdapter_spec.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/spec/modules/consumableBidAdapter_spec.js b/test/spec/modules/consumableBidAdapter_spec.js index d8e75454245..a2e3db176de 100644 --- a/test/spec/modules/consumableBidAdapter_spec.js +++ b/test/spec/modules/consumableBidAdapter_spec.js @@ -519,6 +519,12 @@ describe('Consumable BidAdapter', function () { expect(data1.placements[0].bidfloor).to.equal(0.05); expect(data2.placements[0].bidfloor).to.equal(0.15); }); + it('should contain the language param', function () { + let request = spec.buildRequests(BIDDER_REQUEST_1.bidRequest, BIDDER_REQUEST_1); + let data = JSON.parse(request.data); + + expect(data.lang).to.be.a('string'); + }); }); describe('interpretResponse validation', function () { it('response should have valid bidderCode', function () { From 507b2d0aa558b038a6cc05c5448969e2aa5032d0 Mon Sep 17 00:00:00 2001 From: Jason Piros Date: Thu, 6 Jun 2024 15:20:50 -0600 Subject: [PATCH 3/3] consumableBidAdapter: get lang from bidderRequest --- modules/consumableBidAdapter.js | 2 +- .../spec/modules/consumableBidAdapter_spec.js | 22 ++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/modules/consumableBidAdapter.js b/modules/consumableBidAdapter.js index 12c96082ad5..cb802508de9 100644 --- a/modules/consumableBidAdapter.js +++ b/modules/consumableBidAdapter.js @@ -62,7 +62,7 @@ export const spec = { 'name': 'prebidjs', 'version': '$prebid.version$' }], - lang: (navigator && navigator.language) ? navigator.language.split('-')[0] : '' + lang: bidderRequest.ortb2.device.language, }, validBidRequests[0].params); if (bidderRequest && bidderRequest.gdprConsent) { diff --git a/test/spec/modules/consumableBidAdapter_spec.js b/test/spec/modules/consumableBidAdapter_spec.js index a2e3db176de..073e889d172 100644 --- a/test/spec/modules/consumableBidAdapter_spec.js +++ b/test/spec/modules/consumableBidAdapter_spec.js @@ -66,6 +66,11 @@ const BIDDER_REQUEST_1 = { 'http://example.com/iframe1.html', 'http://example.com/iframe2.html' ] + }, + ortb2: { + device: { + language: 'en' + } } }; @@ -130,6 +135,11 @@ const BIDDER_REQUEST_2 = { 'http://example.com/iframe1.html', 'http://example.com/iframe2.html' ] + }, + ortb2: { + device: { + language: 'en' + } } }; @@ -177,6 +187,11 @@ const BIDDER_REQUEST_VIDEO = { 'http://example.com/iframe1.html', 'http://example.com/iframe2.html' ] + }, + ortb2: { + device: { + language: 'en' + } } }; @@ -188,6 +203,11 @@ const BIDDER_REQUEST_EMPTY = { gdprConsent: { consentString: 'consent-test', gdprApplies: false + }, + ortb2: { + device: { + language: 'en' + } } }; @@ -523,7 +543,7 @@ describe('Consumable BidAdapter', function () { let request = spec.buildRequests(BIDDER_REQUEST_1.bidRequest, BIDDER_REQUEST_1); let data = JSON.parse(request.data); - expect(data.lang).to.be.a('string'); + expect(data.lang).to.equal('en'); }); }); describe('interpretResponse validation', function () {