forked from prebid/Prebid.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'prebid:master' into master
- Loading branch information
Showing
19 changed files
with
1,071 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { auctionManager } from '../../src/auctionManager.js'; | ||
import { config } from '../../src/config.js'; | ||
import { getHook } from '../../src/hook.js'; | ||
|
||
export const MODULE_NAME = 'bidResponseFilter'; | ||
export const BID_CATEGORY_REJECTION_REASON = 'Category is not allowed'; | ||
export const BID_ADV_DOMAINS_REJECTION_REASON = 'Adv domain is not allowed'; | ||
export const BID_ATTR_REJECTION_REASON = 'Attr is not allowed'; | ||
|
||
function init() { | ||
getHook('addBidResponse').before(addBidResponseHook); | ||
}; | ||
|
||
export function addBidResponseHook(next, adUnitCode, bid, reject, index = auctionManager.index) { | ||
const {bcat = [], badv = []} = index.getOrtb2(bid) || {}; | ||
const battr = index.getBidRequest(bid)?.ortb2Imp[bid.mediaType]?.battr || index.getAdUnit(bid)?.ortb2Imp[bid.mediaType]?.battr || []; | ||
const moduleConfig = config.getConfig(MODULE_NAME); | ||
|
||
const catConfig = {enforce: true, blockUnknown: true, ...(moduleConfig?.cat || {})}; | ||
const advConfig = {enforce: true, blockUnknown: true, ...(moduleConfig?.adv || {})}; | ||
const attrConfig = {enforce: true, blockUnknown: true, ...(moduleConfig?.attr || {})}; | ||
|
||
const { primaryCatId, secondaryCatIds = [], advertiserDomains = [], attr: metaAttr } = bid.meta || {}; | ||
|
||
// checking if bid fulfills ortb2 fields rules | ||
if ((catConfig.enforce && bcat.some(category => [primaryCatId, ...secondaryCatIds].includes(category))) || | ||
(catConfig.blockUnknown && !primaryCatId)) { | ||
reject(BID_CATEGORY_REJECTION_REASON); | ||
} else if ((advConfig.enforce && badv.some(domain => advertiserDomains.includes(domain))) || | ||
(advConfig.blockUnknown && !advertiserDomains.length)) { | ||
reject(BID_ADV_DOMAINS_REJECTION_REASON); | ||
} else if ((attrConfig.enforce && battr.includes(metaAttr)) || | ||
(attrConfig.blockUnknown && !metaAttr)) { | ||
reject(BID_ATTR_REJECTION_REASON); | ||
} else { | ||
return next(adUnitCode, bid, reject); | ||
} | ||
} | ||
|
||
init(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { registerBidder } from '../src/adapters/bidderFactory.js'; | ||
import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js'; | ||
import { isBidRequestValid, buildRequests, interpretResponse, getUserSyncs } from '../libraries/teqblazeUtils/bidderUtils.js'; | ||
|
||
const BIDDER_CODE = 'smoot'; | ||
const AD_URL = 'https://endpoint1.smoot.ai/pbjs'; | ||
const SYNC_URL = 'https://usync.smxconv.com'; | ||
|
||
export const spec = { | ||
code: BIDDER_CODE, | ||
supportedMediaTypes: [BANNER, VIDEO, NATIVE], | ||
|
||
isBidRequestValid: isBidRequestValid(['placementId']), | ||
buildRequests: buildRequests(AD_URL), | ||
interpretResponse, | ||
getUserSyncs: getUserSyncs(SYNC_URL) | ||
}; | ||
|
||
registerBidder(spec); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# Overview | ||
|
||
``` | ||
Module Name: Smoot Bidder Adapter | ||
Module Type: Smoot Bidder Adapter | ||
Maintainer: it.ops@smoot.ai | ||
``` | ||
|
||
# Description | ||
|
||
Connects to Smoot exchange for bids. | ||
Smoot bid adapter supports Banner, Video (instream and outstream) and Native. | ||
|
||
# Test Parameters | ||
|
||
``` | ||
var adUnits = [ | ||
// Will return static test banner | ||
{ | ||
code: 'adunit1', | ||
mediaTypes: { | ||
banner: { | ||
sizes: [ [300, 250], [320, 50] ], | ||
} | ||
}, | ||
bids: [ | ||
{ | ||
bidder: 'smoot', | ||
params: { | ||
placementId: 'testBanner', | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
code: 'addunit2', | ||
mediaTypes: { | ||
video: { | ||
playerSize: [ [640, 480] ], | ||
context: 'instream', | ||
minduration: 5, | ||
maxduration: 60, | ||
} | ||
}, | ||
bids: [ | ||
{ | ||
bidder: 'smoot', | ||
params: { | ||
placementId: 'testVideo', | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
code: 'addunit3', | ||
mediaTypes: { | ||
native: { | ||
title: { | ||
required: true | ||
}, | ||
body: { | ||
required: true | ||
}, | ||
icon: { | ||
required: true, | ||
size: [64, 64] | ||
} | ||
} | ||
}, | ||
bids: [ | ||
{ | ||
bidder: 'smoot', | ||
params: { | ||
placementId: 'testNative', | ||
} | ||
} | ||
] | ||
} | ||
]; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.