Skip to content

Commit

Permalink
Support new param in tag call to ZEDO (#3471)
Browse files Browse the repository at this point in the history
* initial commit

* updated contact and tag details

* changes ti support the renderers

* changes to pass dimId

* fixed names of internal mapping

* added comment

* added gdpr param to request and other fixes

* modified api url

* fix

* fixed the secure api call

* rolled back video event callback till we support it

* updated doc with video details

* added bid won and timeout pixel

* added testcase for bid events

* modified testcase

* fixed the url logged

* tag param values passed ot renderer

* added a conditioal check

* changes to support new param to adserver for purpose of tracking

* passed param to renderer

* missing variable defined
  • Loading branch information
skazedo authored and mkendall07 committed Feb 11, 2019
1 parent c2734a7 commit 5ecf54b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
3 changes: 2 additions & 1 deletion integrationExamples/gpt/pbjs_example_gpt.html
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,8 @@
bidder: 'zedo',
params: {
channelCode: 2264002816, //REQUIRED
dimId: 9 //REQUIRED
dimId: 9, //REQUIRED
pubId: 1 // OPTIONAL
}
},
{
Expand Down
9 changes: 6 additions & 3 deletions modules/zedoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export const spec = {
id: bidRequest.bidId,
network: network,
channel: channel,
publisher: bidRequest.params.pubId ? bidRequest.params.pubId : 0,
width: dim[0],
height: dim[1],
dimension: bidRequest.params.dimId,
Expand Down Expand Up @@ -258,11 +259,12 @@ function videoRenderer(bid) {
bid.renderer.push(() => {
let channelCode = utils.deepAccess(bid, 'params.0.channelCode') || 0;
let dimId = utils.deepAccess(bid, 'params.0.dimId') || 0;
let publisher = utils.deepAccess(bid, 'params.0.pubId') || 0;
let options = utils.deepAccess(bid, 'params.0.options') || {};
let channel = (channelCode > 0) ? (channelCode - (bid.network * 1000000)) : 0;
var rndr = new ZdPBTag(bid.adUnitCode, bid.network, bid.width, bid.height, bid.adType, bid.vastXml, channel, dimId,
(encodeURI(utils.getTopWindowUrl()) || ''), options);
rndr.renderAd();
rndr.renderAd(publisher);
});
}

Expand All @@ -288,18 +290,19 @@ function getLoggingData(eid, data) {
data = (utils.isArray(data) && data) || [];

let params = {};
let channel, network, dim, adunitCode, timeToRespond, cpm;
let channel, network, dim, publisher, adunitCode, timeToRespond, cpm;
data.map((adunit) => {
adunitCode = adunit.adUnitCode;
channel = utils.deepAccess(adunit, 'params.0.channelCode') || 0;
network = channel > 0 ? parseInt(channel / 1000000) : 0;
dim = utils.deepAccess(adunit, 'params.0.dimId') * 256 || 0;
publisher = utils.deepAccess(adunit, 'params.0.pubId') || 0;
timeToRespond = adunit.timeout ? adunit.timeout : adunit.timeToRespond;
cpm = adunit.cpm;
});
params.n = network;
params.c = channel;
params.s = '0';
params.s = publisher;
params.x = dim;
params.ai = encodeURI('Prebid^zedo^' + adunitCode + '^' + cpm + '^' + timeToRespond);
params.pu = encodeURI(utils.getTopWindowUrl()) || '';
Expand Down
10 changes: 6 additions & 4 deletions modules/zedoBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ ZEDO has its own renderer and will render the video unit if not defined in the c
{
bidder: 'zedo',
params: {
channelCode: 2264004118
dimId: 9
channelCode: 2264004118, // required
dimId: 9, // required
pubId: 1 // optional
}
}
]
Expand All @@ -53,8 +54,9 @@ ZEDO has its own renderer and will render the video unit if not defined in the c
bidder: 'zedo',
params:
{
channelCode: 2264004593,
dimId: 85
channelCode: 2264004593, // required
dimId: 85, // required
pubId: 1 // optional
}
}
]
Expand Down
9 changes: 5 additions & 4 deletions test/spec/modules/zedoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,16 @@ describe('The ZEDO bidding adapter', function () {
sizes: [[300, 200]],
params: {
channelCode: 20000000,
dimId: 10
dimId: 10,
pubId: 1
},
},
];
const request = spec.buildRequests(bidRequests, bidderRequest);
expect(request.url).to.match(/^\/\/saxp.zedo.com\/asw\/fmh.json/);
expect(request.method).to.equal('GET');
const zedoRequest = request.data;
expect(zedoRequest).to.equal('g={"placements":[{"network":20,"channel":0,"width":300,"height":200,"dimension":10,"version":"$prebid.version$","keyword":"","transactionId":"12345667","renderers":[{"name":"display"}]}]}');
expect(zedoRequest).to.equal('g={"placements":[{"network":20,"channel":0,"publisher":1,"width":300,"height":200,"dimension":10,"version":"$prebid.version$","keyword":"","transactionId":"12345667","renderers":[{"name":"display"}]}]}');
});

it('should properly build a channelCode request for video with type defined', function () {
Expand All @@ -71,7 +72,7 @@ describe('The ZEDO bidding adapter', function () {
expect(request.url).to.match(/^\/\/saxp.zedo.com\/asw\/fmh.json/);
expect(request.method).to.equal('GET');
const zedoRequest = request.data;
expect(zedoRequest).to.equal('g={"placements":[{"network":20,"channel":0,"width":640,"height":480,"dimension":85,"version":"$prebid.version$","keyword":"","transactionId":"12345667","renderers":[{"name":"Inarticle"}]}]}');
expect(zedoRequest).to.equal('g={"placements":[{"network":20,"channel":0,"publisher":0,"width":640,"height":480,"dimension":85,"version":"$prebid.version$","keyword":"","transactionId":"12345667","renderers":[{"name":"Inarticle"}]}]}');
});

describe('buildGDPRRequests', function () {
Expand Down Expand Up @@ -100,7 +101,7 @@ describe('The ZEDO bidding adapter', function () {
const request = spec.buildRequests(bidRequests, bidderRequest);
expect(request.method).to.equal('GET');
const zedoRequest = request.data;
expect(zedoRequest).to.equal('g={"placements":[{"network":20,"channel":0,"width":300,"height":200,"dimension":10,"version":"$prebid.version$","keyword":"","transactionId":"12345667","renderers":[{"name":"display"}]}],"gdpr":1,"gdpr_consent":"BOJ8RZsOJ8RZsABAB8AAAAAZ+A=="}');
expect(zedoRequest).to.equal('g={"placements":[{"network":20,"channel":0,"publisher":0,"width":300,"height":200,"dimension":10,"version":"$prebid.version$","keyword":"","transactionId":"12345667","renderers":[{"name":"display"}]}],"gdpr":1,"gdpr_consent":"BOJ8RZsOJ8RZsABAB8AAAAAZ+A=="}');
});
});
});
Expand Down

0 comments on commit 5ecf54b

Please sign in to comment.