Skip to content

Commit

Permalink
AdagioBidAdapter: Remove some params (prebid#9398)
Browse files Browse the repository at this point in the history
  • Loading branch information
osazos authored and JacobKlein26 committed Feb 8, 2023
1 parent 696ea79 commit 2d9e4b4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 54 deletions.
4 changes: 0 additions & 4 deletions modules/adagioBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -669,10 +669,8 @@ function autoFillParams(bid) {
}

// extra params
setExtraParam(bid, 'environment');
setExtraParam(bid, 'pagetype');
setExtraParam(bid, 'category');
setExtraParam(bid, 'subcategory');
}

function getPageDimensions() {
Expand Down Expand Up @@ -1094,8 +1092,6 @@ export const spec = {
bidObj.placement = bidReq.params.placement;
bidObj.pagetype = bidReq.params.pagetype;
bidObj.category = bidReq.params.category;
bidObj.subcategory = bidReq.params.subcategory;
bidObj.environment = bidReq.params.environment;
}
bidResponses.push(bidObj);
});
Expand Down
26 changes: 4 additions & 22 deletions modules/adagioBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ Below, the list of Adagio params and where they can be set.
| Param name | Global config | AdUnit config |
| ---------- | ------------- | ------------- |
| siteId | x |
| organizationId (obsolete) | | x
| site (obsolete) | | x
| organizationId * | | x
| site * | | x
| pagetype | x | x
| environment | x | x
| category | x | x
| subcategory | x | x
| useAdUnitCodeAsAdUnitElementId | x | x
| useAdUnitCodeAsPlacement | x | x
| placement | | x
Expand All @@ -31,6 +29,8 @@ Below, the list of Adagio params and where they can be set.
| video | | x
| native | | x

_* These params are deprecated in favor the Global configuration setup, see below._

### Global configuration

The global configuration is used to store params once instead of duplicate them to each adUnit. The values will be used as "params" in the ad-request.
Expand All @@ -49,9 +49,7 @@ pbjs.setConfig({
// - underscores `_`
// Also, each param can have at most 50 unique active values (case-insensitive).
pagetype: 'article', // Highly recommended. The pagetype describes what kind of content will be present in the page.
environment: 'mobile', // Recommended. Environment where the page is displayed.
category: 'sport', // Recommended. Category of the content displayed in the page.
subcategory: 'handball', // Optional. Subcategory of the content displayed in the page.
useAdUnitCodeAsAdUnitElementId: false, // Optional. Use it by-pass adUnitElementId and use the adUnit code as value
useAdUnitCodeAsPlacement: false, // Optional. Use it to by-pass placement and use the adUnit code as value
},
Expand All @@ -62,9 +60,7 @@ pbjs.setConfig({

Adagio will use FPD data as fallback for the params below:
- pagetype
- environment
- category
- subcategory

If the FPD value is an array, the 1st value of this array will be used.

Expand Down Expand Up @@ -107,9 +103,7 @@ var adUnits = [
debug: true,
adagio: {
pagetype: 'article',
environment: 'mobile',
category: 'sport',
subcategory: 'handball',
useAdUnitCodeAsAdUnitElementId: false,
useAdUnitCodeAsPlacement: false,
}
Expand Down Expand Up @@ -208,12 +202,6 @@ var adUnits = [
return bidResponse.site;
}
},
{
key: "environment",
val: function (bidResponse) {
return bidResponse.environment;
}
},
{
key: "placement",
val: function (bidResponse) {
Expand All @@ -231,12 +219,6 @@ var adUnits = [
val: function (bidResponse) {
return bidResponse.category;
}
},
{
key: "subcategory",
val: function (bidResponse) {
return bidResponse.subcategory;
}
}
]
}
Expand Down
29 changes: 1 addition & 28 deletions test/spec/modules/adagioBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,8 @@ describe('Adagio bid adapter', () => {
site: {
ext: {
data: {
environment: 'desktop',
pagetype: 'abc',
category: ['cat1', 'cat2', 'cat3'],
subcategory: []
category: ['cat1', 'cat2', 'cat3']
}
}
}
Expand All @@ -167,17 +165,11 @@ describe('Adagio bid adapter', () => {
return utils.deepAccess(config, key);
});

setExtraParam(bid, 'environment');
expect(bid.params.environment).to.equal('desktop');

setExtraParam(bid, 'pagetype')
expect(bid.params.pagetype).to.equal('article');

setExtraParam(bid, 'category');
expect(bid.params.category).to.equal('cat1'); // Only the first value is kept

setExtraParam(bid, 'subcategory');
expect(bid.params.subcategory).to.be.undefined;
});

it('should use the adUnit param unit if defined', function() {
Expand Down Expand Up @@ -784,8 +776,6 @@ describe('Adagio bid adapter', () => {
adUnitElementId: 'gpt-adunit-code',
pagetype: 'ARTICLE',
category: 'NEWS',
subcategory: 'SPORT',
environment: 'desktop',
supportIObs: true
},
adUnitCode: 'adunit-code',
Expand Down Expand Up @@ -833,8 +823,6 @@ describe('Adagio bid adapter', () => {
site: 'SITE-NAME',
pagetype: 'ARTICLE',
category: 'NEWS',
subcategory: 'SPORT',
environment: 'desktop',
aDomain: ['advertiser.com'],
mediaType: 'banner',
meta: {
Expand Down Expand Up @@ -868,8 +856,6 @@ describe('Adagio bid adapter', () => {
site: 'SITE-NAME',
pagetype: 'ARTICLE',
category: 'NEWS',
subcategory: 'SPORT',
environment: 'desktop',
aDomain: ['advertiser.com'],
mediaType: 'banner',
meta: {
Expand Down Expand Up @@ -1392,19 +1378,6 @@ describe('Adagio bid adapter', () => {
});

describe.skip('optional params auto detection', function() {
it('should auto detect environment', function() {
const getDeviceStub = sandbox.stub(_features, 'getDevice');

getDeviceStub.returns(5);
expect(adagio.autoDetectEnvironment()).to.eq('tablet');

getDeviceStub.returns(4);
expect(adagio.autoDetectEnvironment()).to.eq('mobile');

getDeviceStub.returns(2);
expect(adagio.autoDetectEnvironment()).to.eq('desktop');
});

it('should auto detect adUnitElementId when GPT is used', function() {
sandbox.stub(utils, 'getGptSlotInfoForAdUnitCode').withArgs('banner').returns({divId: 'gpt-banner'});
expect(adagio.autoDetectAdUnitElementId('banner')).to.eq('gpt-banner');
Expand Down

0 comments on commit 2d9e4b4

Please sign in to comment.