Skip to content

Commit

Permalink
Merge pull request #7 from washingtonpost/slot-suffix
Browse files Browse the repository at this point in the history
adding ability to target header bidding via a suffix
  • Loading branch information
maddoxnelson authored Aug 24, 2018
2 parents 4d47c2b + f304c88 commit 0e178b6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
13 changes: 9 additions & 4 deletions dist/arcads.js

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions src/services/headerbidding.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export function fetchBids({
wrapper,
bidding,
correlator = false,
prerender
prerender,
}) {
const adInfo = {
adUnit: ad,
Expand All @@ -89,6 +89,9 @@ export function fetchBids({
const prebidBids = new Promise((resolve) => {
if (wrapper.prebid && wrapper.prebid.enabled) {
const timeout = wrapper.prebid.timeout || 700;
if (bidding.prebid.slotSuffix) {
adInfo.adSlot = `${slotName}${bidding.prebid.slotSuffix}`;
}

queuePrebidCommand.bind(this, fetchPrebidBids(ad, id, timeout, adInfo, prerender, () => {
resolve('Fetched Prebid ads!');
Expand All @@ -100,7 +103,9 @@ export function fetchBids({

const amazonBids = new Promise((resolve) => {
if (wrapper.amazon && wrapper.amazon.enabled) {
fetchAmazonBids(id, slotName, dimensions, () => {
const targetedSlotName = bidding.amazon.slotSuffix ? `${slotName}${bidding.amazon.slotSuffix}` : slotName;

fetchAmazonBids(id, targetedSlotName, dimensions, () => {
resolve('Fetched Amazon ads!');
});
} else {
Expand Down

0 comments on commit 0e178b6

Please sign in to comment.