Skip to content

Commit

Permalink
Add content language extraction in bidderUtils (#12172)
Browse files Browse the repository at this point in the history
This update adds a new constant `contentLang` that extracts the content language from the bidder request or defaults to the document's language. The `contentLang` constant is then included in the bid request data, ensuring the correct language information is passed along.
  • Loading branch information
saar120 authored Aug 25, 2024
1 parent 769e7fe commit 87e198f
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libraries/vidazooUtils/bidderUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ export function buildRequestData(bid, topWindowUrl, sizes, bidderRequest, bidder
const contentData = deepAccess(bidderRequest, 'ortb2.site.content.data', []);
const userData = deepAccess(bidderRequest, 'ortb2.user.data', []);

const contentLang = deepAccess(bidderRequest, 'ortb2.site.content.language') || document.documentElement.lang;

if (isFn(bid.getFloor)) {
const floorInfo = bid.getFloor({
currency: 'USD',
Expand Down Expand Up @@ -278,6 +280,7 @@ export function buildRequestData(bid, topWindowUrl, sizes, bidderRequest, bidder
gpid: gpid,
cat: cat,
contentData,
contentLang,
userData: userData,
pagecat: pagecat,
transactionId: ortb2Imp?.ext?.tid,
Expand Down
7 changes: 7 additions & 0 deletions test/spec/modules/illuminBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ const BIDDER_REQUEST = {
'ref': 'https://www.somereferrer.com'
},
'ortb2': {
'site': {
'content': {
'language': 'en'
}
},
'regs': {
'gpp': 'gpp_string',
'gpp_sid': [7]
Expand Down Expand Up @@ -331,6 +336,7 @@ describe('IlluminBidAdapter', function () {
gpid: '0123456789',
cat: [],
contentData: [],
contentLang: 'en',
isStorageAllowed: true,
pagecat: [],
userData: []
Expand Down Expand Up @@ -397,6 +403,7 @@ describe('IlluminBidAdapter', function () {
'ext.param2': 'dolorsitamet',
cat: [],
contentData: [],
contentLang: 'en',
isStorageAllowed: true,
pagecat: [],
userData: []
Expand Down
7 changes: 7 additions & 0 deletions test/spec/modules/kueezRtbBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ const BIDDER_REQUEST = {
'ref': 'https://www.somereferrer.com'
},
'ortb2': {
'site': {
'content': {
'language': 'en'
}
},
'regs': {
'gpp': 'gpp_string',
'gpp_sid': [7]
Expand Down Expand Up @@ -327,6 +332,7 @@ describe('KueezRtbBidAdapter', function () {
},
gpid: '',
cat: [],
contentLang: 'en',
contentData: [],
isStorageAllowed: true,
pagecat: [],
Expand Down Expand Up @@ -393,6 +399,7 @@ describe('KueezRtbBidAdapter', function () {
'ext.param1': 'loremipsum',
'ext.param2': 'dolorsitamet',
cat: [],
contentLang: 'en',
contentData: [],
isStorageAllowed: true,
pagecat: [],
Expand Down
7 changes: 7 additions & 0 deletions test/spec/modules/shinezRtbBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ const BIDDER_REQUEST = {
'ref': 'https://www.somereferrer.com'
},
'ortb2': {
'site': {
'content': {
'language': 'en'
}
},
'regs': {
'gpp': 'gpp_string',
'gpp_sid': [7]
Expand Down Expand Up @@ -332,6 +337,7 @@ describe('ShinezRtbBidAdapter', function () {
},
gpid: '0123456789',
cat: [],
contentLang: 'en',
contentData: [],
isStorageAllowed: true,
pagecat: [],
Expand Down Expand Up @@ -398,6 +404,7 @@ describe('ShinezRtbBidAdapter', function () {
'ext.param1': 'loremipsum',
'ext.param2': 'dolorsitamet',
cat: [],
contentLang: 'en',
contentData: [],
isStorageAllowed: true,
pagecat: [],
Expand Down
7 changes: 7 additions & 0 deletions test/spec/modules/tagorasBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ const BIDDER_REQUEST = {
'ref': 'https://www.somereferrer.com'
},
'ortb2': {
'site': {
'content': {
'language': 'en'
}
},
'regs': {
'gpp': 'gpp_string',
'gpp_sid': [7]
Expand Down Expand Up @@ -329,6 +334,7 @@ describe('TagorasBidAdapter', function () {
},
gpid: '',
cat: [],
contentLang: 'en',
contentData: [],
isStorageAllowed: true,
pagecat: [],
Expand Down Expand Up @@ -394,6 +400,7 @@ describe('TagorasBidAdapter', function () {
'ext.param1': 'loremipsum',
'ext.param2': 'dolorsitamet',
cat: [],
contentLang: 'en',
contentData: [],
isStorageAllowed: true,
pagecat: [],
Expand Down
4 changes: 4 additions & 0 deletions test/spec/modules/twistDigitalBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ const BIDDER_REQUEST = {
'cat': ['IAB2'],
'pagecat': ['IAB2-2'],
'content': {
'language': 'en',
'data': [{
'name': 'example.com',
'ext': {
Expand Down Expand Up @@ -337,6 +338,7 @@ describe('TwistDigitalBidAdapter', function () {
'bitness': '64',
'architecture': ''
},
contentLang: 'en',
contentData: [{
'name': 'example.com',
'ext': {
Expand Down Expand Up @@ -438,6 +440,7 @@ describe('TwistDigitalBidAdapter', function () {
gpid: '1234567890',
cat: ['IAB2'],
pagecat: ['IAB2-2'],
contentLang: 'en',
contentData: [{
'name': 'example.com',
'ext': {
Expand Down Expand Up @@ -524,6 +527,7 @@ describe('TwistDigitalBidAdapter', function () {
gpid: '1234567890',
cat: ['IAB2'],
pagecat: ['IAB2-2'],
contentLang: 'en',
contentData: [{
'name': 'example.com',
'ext': {
Expand Down
4 changes: 4 additions & 0 deletions test/spec/modules/vidazooBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ const BIDDER_REQUEST = {
'cat': ['IAB2'],
'pagecat': ['IAB2-2'],
'content': {
'language': 'en',
'data': [{
'name': 'example.com',
'ext': {
Expand Down Expand Up @@ -342,6 +343,7 @@ describe('VidazooBidAdapter', function () {
'bitness': '64',
'architecture': ''
},
contentLang: 'en',
contentData: [{
'name': 'example.com',
'ext': {
Expand Down Expand Up @@ -450,6 +452,7 @@ describe('VidazooBidAdapter', function () {
gpid: '1234567890',
cat: ['IAB2'],
pagecat: ['IAB2-2'],
contentLang: 'en',
contentData: [{
'name': 'example.com',
'ext': {
Expand Down Expand Up @@ -541,6 +544,7 @@ describe('VidazooBidAdapter', function () {
gpid: '1234567890',
cat: ['IAB2'],
pagecat: ['IAB2-2'],
contentLang: 'en',
contentData: [{
'name': 'example.com',
'ext': {
Expand Down

0 comments on commit 87e198f

Please sign in to comment.