Skip to content

Commit

Permalink
AIDEM Bid Adapter: added wpar and placementId param (prebid#9377)
Browse files Browse the repository at this point in the history
* AIDEM Bid Adapter

* Added _spec.js

* update

* Fix Navigator in _spec.js

* Removed timeout handler.

* Added publisherId as required bidder params

* moved publisherId into site publisher object

* Added wpar to environment

* Added placementId parameter

* added unit tests for the wpar environment object

Co-authored-by: darkstar <canazza@wazabit.it>
Co-authored-by: AndreaC <67786179+darkstarac@users.noreply.github.com>
  • Loading branch information
3 people authored and JacobKlein26 committed Feb 8, 2023
1 parent 3a20dbf commit d099321
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions modules/aidemBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ function setPrebidImpressionObject(bidRequests, payload) {
deepSetValue(impressionObject, 'id', bidRequest.bidId);
// Transaction id
deepSetValue(impressionObject, 'tid', deepAccess(bidRequest, 'transactionId'));
// Placement id
deepSetValue(impressionObject, 'tagid', deepAccess(bidRequest, 'params.placementId', null));
// Publisher id
deepSetValue(payload, 'site.publisher.id', deepAccess(bidRequest, 'params.publisherId'));
// Site id
Expand Down Expand Up @@ -265,6 +267,8 @@ function setPrebidRequestEnvironment(payload) {
deepSetValue(payload, 'environment.inp.jp', window.JSON.parse.name === 'parse' && typeof window.JSON.parse.prototype === 'undefined');
deepSetValue(payload, 'environment.inp.ofe', window.Object.fromEntries.name === 'fromEntries' && typeof window.Object.fromEntries.prototype === 'undefined');
deepSetValue(payload, 'environment.inp.oa', window.Object.assign.name === 'assign' && typeof window.Object.assign.prototype === 'undefined');
deepSetValue(payload, 'environment.wpar.innerWidth', window.innerWidth);
deepSetValue(payload, 'environment.wpar.innerHeight', window.innerHeight);
}

function setPrebidImpressionObjectFloor(bidRequest, impressionObject) {
Expand Down
1 change: 1 addition & 0 deletions modules/aidemBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ This module is GDPR and CCPA compliant, and no 3rd party userIds are allowed.
|---------------|----------|---------------------|---------------|----------|
| `siteId` | required | Unique site ID | `'ABCDEF'` | `String` |
| `publisherId` | required | Unique publisher ID | `'ABCDEF'` | `String` |
| `placementId` | optional | Unique publisher tag ID | `'ABCDEF'` | `String` |


### Banner Bid Params
Expand Down
12 changes: 10 additions & 2 deletions test/spec/modules/aidemBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ describe('Aidem adapter', () => {
expect(payload.imp).to.be.a('array').that.has.lengthOf(DEFAULT_VALID_BANNER_REQUESTS.length)

expect(payload.imp[0]).to.be.a('object').that.has.all.keys(
'banner', 'id', 'mediatype', 'imp_ext', 'tid'
'banner', 'id', 'mediatype', 'imp_ext', 'tid', 'tagid'
)
expect(payload.imp[0].banner).to.be.a('object').that.has.all.keys(
'format', 'topframe'
Expand All @@ -401,7 +401,7 @@ describe('Aidem adapter', () => {
expect(payload.imp).to.be.a('array').that.has.lengthOf(DEFAULT_VALID_VIDEO_REQUESTS.length)

expect(payload.imp[0]).to.be.a('object').that.has.all.keys(
'video', 'id', 'mediatype', 'imp_ext', 'tid'
'video', 'id', 'mediatype', 'imp_ext', 'tid', 'tagid'
)
expect(payload.imp[0].video).to.be.a('object').that.has.all.keys(
'format', 'mimes', 'minDuration', 'maxDuration', 'protocols'
Expand All @@ -421,6 +421,14 @@ describe('Aidem adapter', () => {
'value', 'currency'
)
});

it('should hav wpar keys in environment object', function () {
const requests = spec.buildRequests(DEFAULT_VALID_VIDEO_REQUESTS, VALID_BIDDER_REQUEST);
const payload = JSON.parse(requests.data)
expect(payload).to.have.property('environment')
expect(payload.environment).to.be.a('object').that.have.property('wpar')
expect(payload.environment.wpar).to.be.a('object').that.has.keys('innerWidth', 'innerHeight')
});
})

describe('interpretResponse', () => {
Expand Down

0 comments on commit d099321

Please sign in to comment.