Skip to content

Commit

Permalink
Update Yieldlab adapter and add official maintainer (#2231)
Browse files Browse the repository at this point in the history
* Set time to live to 5 minutes

Yieldlab auctions are valid for 5 minutes and not 10. A delivery of an adtag would lead to a new auction after the 5 minute expiration time.

* Use correct identifer for deals

Did stands for demandId which is not a default and not a good identifer for deals. We should use pid (partnershipId) here as a unique identifer for a connection between supply and demand (including deals).

* Set revenue to gross-price

* Add dynamic adsize for vast url

The adsize of a video placement can have a lot of different adsizes and is never "1x1".

* Change maintainer to Yieldlab

Platform Lunar and Yieldlab agree that the Adapter should be offically maintained by Yieldlab.

* Use yieldlab test campaigns

Campaigns set up in Yieldlab's test network to deliver all the time.

* Use yieldlab naming for params

To make it less confusing for customers, we should use the actual naming used in our systems for the params used.

* Update test spec for yieldlab adapter

* Add test for pid to dealId mapping
  • Loading branch information
mirkorean authored and harpere committed Mar 19, 2018
1 parent b9906c3 commit 6382fe6
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 37 deletions.
22 changes: 11 additions & 11 deletions modules/yieldlabBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import { VIDEO, BANNER } from 'src/mediaTypes'

const ENDPOINT = 'https://ad.yieldlab.net'
const BIDDER_CODE = 'yieldlab'
const BID_RESPONSE_TTL_SEC = 600
const BID_RESPONSE_TTL_SEC = 300
const CURRENCY_CODE = 'EUR'

export const spec = {
code: BIDDER_CODE,
supportedMediaTypes: [VIDEO, BANNER],

isBidRequestValid: function (bid) {
if (bid && bid.params && bid.params.placementId && bid.params.adSize) {
if (bid && bid.params && bid.params.adslotId && bid.params.adSize) {
return true
}
return false
Expand All @@ -25,18 +25,18 @@ export const spec = {
* @returns {{method: string, url: string}}
*/
buildRequests: function (validBidRequests) {
const placementIds = []
const adslotIds = []
const timestamp = Date.now()

utils._each(validBidRequests, function (bid) {
placementIds.push(bid.params.placementId)
adslotIds.push(bid.params.adslotId)
})

const placements = placementIds.join(',')
const adslots = adslotIds.join(',')

return {
method: 'GET',
url: `${ENDPOINT}/yp/${placements}?ts=${timestamp}&json=true`,
url: `${ENDPOINT}/yp/${adslots}?ts=${timestamp}&json=true`,
validBidRequests: validBidRequests
}
},
Expand All @@ -56,7 +56,7 @@ export const spec = {
}

let matchedBid = find(serverResponse.body, function (bidResponse) {
return bidRequest.params.placementId == bidResponse.id
return bidRequest.params.adslotId == bidResponse.id
})

if (matchedBid) {
Expand All @@ -67,16 +67,16 @@ export const spec = {
width: sizes[0],
height: sizes[1],
creativeId: '' + matchedBid.id,
dealId: matchedBid.did,
dealId: matchedBid.pid,
currency: CURRENCY_CODE,
netRevenue: true,
netRevenue: false,
ttl: BID_RESPONSE_TTL_SEC,
referrer: '',
ad: `<script src="${ENDPOINT}/d/${matchedBid.id}/${bidRequest.params.accountId}/${sizes[0]}x${sizes[1]}?ts=${timestamp}"></script>`
ad: `<script src="${ENDPOINT}/d/${matchedBid.id}/${bidRequest.params.supplyId}/${sizes[0]}x${sizes[1]}?ts=${timestamp}"></script>`
}
if (isVideo(bidRequest)) {
bidResponse.mediaType = VIDEO
bidResponse.vastUrl = `${ENDPOINT}/d/${matchedBid.id}/${bidRequest.params.accountId}/1x1?ts=${timestamp}`
bidResponse.vastUrl = `${ENDPOINT}/d/${matchedBid.id}/${bidRequest.params.supplyId}/${sizes[0]}x${sizes[1]}?ts=${timestamp}`
}

bidResponses.push(bidResponse)
Expand Down
22 changes: 11 additions & 11 deletions modules/yieldlabBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
```
Module Name: Yieldlab Bidder Adapter
Module Type: Bidder Adapter
Maintainer: api@platform-lunar.com
Maintainer: solutions@yieldlab.de
```

# Description
Expand All @@ -14,19 +14,19 @@ Module that connects to Yieldlab's demand sources
```
var adUnits = [
{
code: "test1",
sizes: [[800, 250]]
code: "banner",
sizes: [[728, 90]],
bids: [{
bidder: "yieldlab",
params: {
placement: "4206978",
accountId: "2358365",
adSize: "800x250"
adslotId: "5220336",
supplyId: "1381604",
adSize: "728x90"
}
}]
}, {
code: "test2",
sizes: [[1, 1]],
code: "video",
sizes: [[640, 480]],
mediaTypes: {
video: {
context: "instream"
Expand All @@ -35,9 +35,9 @@ Module that connects to Yieldlab's demand sources
bids: [{
bidder: "yieldlab",
params: {
placementId: "4207034",
accountId: "2358365",
adSize: "1x1"
adslotId: "5220339",
supplyId: "1381604",
adSize: "640x480"
}
}]
}
Expand Down
31 changes: 16 additions & 15 deletions test/spec/modules/yieldlabBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,24 @@ import { newBidder } from 'src/adapters/bidderFactory'
const REQUEST = {
'bidder': 'yieldlab',
'params': {
'placementId': '1111',
'accountId': '2222',
'adSize': '800x250'
'adslotId': '1111',
'supplyId': '2222',
'adSize': '728x90'
},
'bidderRequestId': '143346cf0f1731',
'auctionId': '2e41f65424c87c',
'adUnitCode': 'adunit-code',
'bidId': '2d925f27f5079f',
'sizes': [1, 1]
'sizes': [728, 90]
}

const RESPONSE = {
advertiser: 'yieldlab',
curl: 'https://www.yieldlab.de',
format: 0,
id: 1111,
price: 1
price: 1,
pid: 2222
}

describe('yieldlabBidAdapter', () => {
Expand All @@ -37,9 +38,9 @@ describe('yieldlabBidAdapter', () => {
it('should return true when required params found', () => {
const request = {
'params': {
'placementId': '1111',
'accountId': '2222',
'adSize': '800x250'
'adslotId': '1111',
'supplyId': '2222',
'adSize': '728x90'
}
}
expect(spec.isBidRequestValid(request)).to.equal(true)
Expand Down Expand Up @@ -78,15 +79,15 @@ describe('yieldlabBidAdapter', () => {

expect(result[0].requestId).to.equal('2d925f27f5079f')
expect(result[0].cpm).to.equal(0.01)
expect(result[0].width).to.equal(800)
expect(result[0].height).to.equal(250)
expect(result[0].width).to.equal(728)
expect(result[0].height).to.equal(90)
expect(result[0].creativeId).to.equal('1111')
expect(result[0].dealId).to.equal(undefined)
expect(result[0].dealId).to.equal(2222)
expect(result[0].currency).to.equal('EUR')
expect(result[0].netRevenue).to.equal(true)
expect(result[0].ttl).to.equal(600)
expect(result[0].netRevenue).to.equal(false)
expect(result[0].ttl).to.equal(300)
expect(result[0].referrer).to.equal('')
expect(result[0].ad).to.include('<script src="https://ad.yieldlab.net/d/1111/2222/800x250?ts=')
expect(result[0].ad).to.include('<script src="https://ad.yieldlab.net/d/1111/2222/728x90?ts=')
})

it('should add vastUrl when type is video', () => {
Expand All @@ -105,7 +106,7 @@ describe('yieldlabBidAdapter', () => {
expect(result[0].requestId).to.equal('2d925f27f5079f')
expect(result[0].cpm).to.equal(0.01)
expect(result[0].mediaType).to.equal('video')
expect(result[0].vastUrl).to.include('https://ad.yieldlab.net/d/1111/2222/1x1?ts=')
expect(result[0].vastUrl).to.include('https://ad.yieldlab.net/d/1111/2222/728x90?ts=')
})
})
})

0 comments on commit 6382fe6

Please sign in to comment.