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

Automatad Bid Adapter: register on timeout event and endpoint changes #8030

Merged
merged 33 commits into from
Feb 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
ea042d0
added automatad bid adapter
Mar 23, 2020
c2a3ab6
added automatad bid adapter readme
Mar 23, 2020
2d98d8f
added automatad bidder adapter unit test
Mar 23, 2020
9b84d57
updated maintainer email id for automatad adapter
Mar 23, 2020
85611aa
refactored automatadBidAdapter js
Mar 23, 2020
8ef416c
refactored automatadBidAdapter unit test
Mar 23, 2020
70e3956
refactored automatadBidAdapter unit test
Mar 23, 2020
1d1d2cd
added usersync code to automatad bid adapter
Mar 23, 2020
8c4c2a8
Added unit test for onBidWon in automatadBidAdapter_spec
Mar 29, 2020
ce62f83
removed trailing spaces
Mar 29, 2020
f359711
removed trailing space
Mar 29, 2020
3856574
Merge branch 'master' of https://github.com/kanchika-automatad/Prebid.js
Mar 29, 2020
3897bce
changes for getUserSync function
Mar 30, 2020
88d84a1
lint error fixes
Mar 30, 2020
c1305a0
updated usersync url
Mar 30, 2020
581472a
additional test for onBidWon function added
Mar 30, 2020
6a2bf79
added ajax stub in test
Apr 6, 2020
6652aea
Merge remote-tracking branch 'upstream/master'
May 19, 2020
53e7379
updated winurl params
May 19, 2020
c8c7b35
lint fixes
May 19, 2020
0684cb9
Merge remote-tracking branch 'upstream/master'
Aug 4, 2020
17725dc
added adunitCode in bid request
Aug 4, 2020
56c6f56
added test for adunit code
Aug 6, 2020
033cf50
Merge remote-tracking branch 'upstream/master'
Aug 25, 2020
d68d9a6
add placement in impression object
Aug 26, 2020
8abfb3c
Merge remote-tracking branch 'upstream/master'
Sep 4, 2020
935b550
added code to interpret multiple bid response in seatbid
Sep 4, 2020
a98e385
Merge branch 'master' of https://github.com/prebid/Prebid.js
Apr 1, 2021
a044a2c
added bid meta with advertiserDomains
Apr 1, 2021
4022cb5
Merge branch 'prebid:master' into master
Feb 8, 2022
5b8ce78
endpoint url changes
Feb 9, 2022
925139d
added format changes
Feb 9, 2022
07454e2
macro substitution change added
Feb 9, 2022
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
17 changes: 10 additions & 7 deletions modules/automatadBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {ajax} from '../src/ajax.js'

const BIDDER = 'automatad'

const ENDPOINT_URL = 'https://rtb2.automatad.com/ortb2'
const ENDPOINT_URL = 'https://bid.atmtd.com'

const DEFAULT_BID_TTL = 30
const DEFAULT_CURRENCY = 'USD'
Expand Down Expand Up @@ -57,7 +57,7 @@ export const spec = {
const payloadString = JSON.stringify(openrtbRequest)
return {
method: 'POST',
url: ENDPOINT_URL + '/resp',
url: ENDPOINT_URL + '/request',
data: payloadString,
options: {
contentType: 'application/json',
Expand All @@ -72,6 +72,7 @@ export const spec = {
const response = (serverResponse || {}).body

if (response && response.seatbid && response.seatbid[0].bid && response.seatbid[0].bid.length) {
var bidid = response.bidid
response.seatbid.forEach(bidObj => {
bidObj.bid.forEach(bid => {
bidResponses.push({
Expand All @@ -88,6 +89,7 @@ export const spec = {
height: bid.h,
netRevenue: DEFAULT_NET_REVENUE,
nurl: bid.nurl,
bidId: bidid
})
})
})
Expand All @@ -97,11 +99,9 @@ export const spec = {

return bidResponses
},
getUserSyncs: function(syncOptions, serverResponse) {
return [{
type: 'iframe',
url: 'https://rtb2.automatad.com/ortb2/async_usersync'
}]
onTimeout: function(timeoutData) {
const timeoutUrl = ENDPOINT_URL + '/timeout'
ajax(timeoutUrl, null, JSON.stringify(timeoutData))
},
onBidWon: function(bid) {
if (!bid.nurl) { return }
Expand All @@ -116,6 +116,9 @@ export const spec = {
).replace(
/\$\{AUCTION_CURRENCY\}/,
winCurr
).replace(
/\$\{AUCTON_BID_ID\}/,
bid.bidId
).replace(
/\$\{AUCTION_ID\}/,
bid.auctionId
Expand Down
30 changes: 23 additions & 7 deletions test/spec/modules/automatadBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ describe('automatadBidAdapter', function () {
{
'bid': [
{
'bidId': '123',
'adm': '<!-- creative code -->',
'adomain': [
'someAdDomain'
Expand Down Expand Up @@ -173,14 +174,29 @@ describe('automatadBidAdapter', function () {
})
})

describe('getUserSyncs', function () {
it('should return iframe sync', function () {
let sync = spec.getUserSyncs()
expect(sync.length).to.equal(1)
expect(sync[0].type === 'iframe')
expect(typeof sync[0].url === 'string')
describe('onTimeout', function () {
const timeoutData = {
'bidId': '123',
'bidder': 'automatad',
'adUnitCode': 'div-13',
'auctionId': '1232',
'params': [
{
'siteId': 'test',
'placementId': 'test123'
}
],
'timeout': 1000
}

it('should exists and be a function', function () {
expect(spec.onTimeout).to.exist.and.to.be.a('function');
});

it('should include timeoutData', function () {
expect(spec.onTimeout(timeoutData)).to.be.undefined;
})
})
});

describe('onBidWon', function () {
let serverResponses = spec.interpretResponse(expectedResponse[0])
Expand Down