Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Platform.io Bidder Adapter update #1817

Merged
merged 35 commits into from
Nov 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
2cc71fb
Add PlatformioBidAdapter
varashellov Aug 1, 2017
6801ca1
Update platformioBidAdapter.js
varashellov Aug 2, 2017
9bdcd7e
Add files via upload
varashellov Aug 2, 2017
06c04ce
Update hello_world.html
varashellov Aug 2, 2017
3e11a2a
Update platformioBidAdapter.js
varashellov Aug 2, 2017
e3d049e
Update platformioBidAdapter_spec.js
varashellov Aug 2, 2017
c09d8ae
Update hello_world.html
varashellov Aug 2, 2017
e0be49c
Update platformioBidAdapter_spec.js
varashellov Aug 7, 2017
eedbd3e
Update platformioBidAdapter.js
varashellov Aug 14, 2017
faa9963
Update hello_world.html
varashellov Aug 14, 2017
946d081
Add files via upload
varashellov Aug 14, 2017
69b4f57
Update platformioBidAdapter
varashellov Aug 16, 2017
659562a
Update platformioBidAdapter
varashellov Aug 16, 2017
66a3f7f
Update platformioBidAdapter
varashellov Aug 16, 2017
225b798
Merge pull request #1 from varashellov/varashellov-patch-1
varashellov Aug 16, 2017
cd21b96
Add files via upload
varashellov Oct 17, 2017
e426d54
Add files via upload
varashellov Oct 17, 2017
4ac6786
Add files via upload
varashellov Oct 17, 2017
6cc3ec1
Merge branch 'master' into master
varashellov Oct 18, 2017
ccdfd49
Update platformioBidAdapter.js
varashellov Oct 19, 2017
3947c83
Update platformioBidAdapter_spec.js
varashellov Oct 19, 2017
6451e5b
Update platformioBidAdapter_spec.js
varashellov Oct 19, 2017
9282871
Update platformioBidAdapter_spec.js
varashellov Oct 19, 2017
7b60d11
Update platformioBidAdapter.js
varashellov Oct 19, 2017
1124da8
Update platformioBidAdapter.js
varashellov Oct 19, 2017
176c633
Update platformioBidAdapter_spec.js
varashellov Oct 19, 2017
96245d6
Add files via upload
varashellov Oct 20, 2017
380be34
Add files via upload
varashellov Oct 20, 2017
ffcfb29
Add files via upload
varashellov Oct 20, 2017
6d9cff3
Add files via upload
varashellov Nov 9, 2017
8ea886d
Add files via upload
varashellov Nov 9, 2017
0896c99
Add files via upload
varashellov Nov 9, 2017
764034a
Merge branch 'master' into master
varashellov Nov 9, 2017
af7b0c4
Update platformioBidAdapter.js
varashellov Nov 13, 2017
c1c9a48
Update platformioBidAdapter_spec.js
varashellov Nov 13, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions modules/platformioBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ function bidResponseAvailable(bidRequest, bidResponse) {
const bids = [];
Object.keys(idToImpMap).forEach(id => {
if (idToBidMap[id]) {
const bid = {
requestId: id,
cpm: idToBidMap[id].price,
creative_id: id,
creativeId: id,
adId: id,
};
const bid = {};
bid.requestId = id;
bid.creativeId = idToBidMap[id].adid;
bid.cpm = idToBidMap[id].price;
bid.currency = bidResponse.cur;
bid.ttl = 360;
bid.netRevenue = true;
bid.ad = idToBidMap[id].adm;
bid.ad = bid.ad.replace(/\$(%7B|\{)AUCTION_IMP_ID(%7D|\})/gi, idToBidMap[id].impid);
bid.ad = bid.ad.replace(/\$(%7B|\{)AUCTION_AD_ID(%7D|\})/gi, idToBidMap[id].adid);
Expand All @@ -66,7 +66,7 @@ function impression(slot) {
return {
id: slot.bidId,
banner: banner(slot),
bidfloor: '0.000001',
bidfloor: slot.params.bidFloor || '0.000001',
tagid: slot.params.placementId.toString(),
};
}
Expand Down
7 changes: 4 additions & 3 deletions modules/platformioBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ Please use ```platformio``` as the bidder code.
bids: [{
bidder: 'platformio',
params: {
pubId: '28082',
siteId: '26047',
pubId: '28082', // required
siteId: '26047', // required
size: '250X250', // required
placementId: '123',
size: '250X250'
bidFloor: '0.001'
}
}]
}];
Expand Down
17 changes: 11 additions & 6 deletions test/spec/modules/platformioBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ describe('Platformio Adapter Tests', () => {
pubId: '28082',
siteId: '26047',
placementId: '123',
size: '300x250'
size: '300x250',
bidFloor: '0.001'
}
}, {
placementCode: '/DfpAccount2/slot2',
Expand Down Expand Up @@ -44,11 +45,13 @@ describe('Platformio Adapter Tests', () => {
expect(ortbRequest.imp[0].banner).to.not.equal(null);
expect(ortbRequest.imp[0].banner.w).to.equal(300);
expect(ortbRequest.imp[0].banner.h).to.equal(250);
expect(ortbRequest.imp[0].bidfloor).to.equal('0.001');
// slot 2
expect(ortbRequest.imp[1].tagid).to.equal('456');
expect(ortbRequest.imp[1].banner).to.not.equal(null);
expect(ortbRequest.imp[1].banner.w).to.equal(250);
expect(ortbRequest.imp[1].banner.h).to.equal(250);
expect(ortbRequest.imp[1].bidfloor).to.equal('0.000001');
});

it('Verify parse response', () => {
Expand All @@ -59,9 +62,11 @@ describe('Platformio Adapter Tests', () => {
bid: [{
impid: ortbRequest.imp[0].id,
price: 1.25,
adm: 'This is an Ad'
adm: 'This is an Ad',
adid: '471810',
}]
}]
}],
cur: 'USD'
};
const bids = spec.interpretResponse({ body: ortbResponse }, request);
expect(bids).to.have.lengthOf(1);
Expand All @@ -71,9 +76,9 @@ describe('Platformio Adapter Tests', () => {
expect(bid.ad).to.equal('This is an Ad');
expect(bid.width).to.equal(300);
expect(bid.height).to.equal(250);
expect(bid.adId).to.equal('bid12345');
expect(bid.creative_id).to.equal('bid12345');
expect(bid.creativeId).to.equal('bid12345');
expect(bid.creativeId).to.equal('471810');
expect(bid.currency).to.equal('USD');
expect(bid.ttl).to.equal(360);
});

it('Verify full passback', () => {
Expand Down