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

Module - Size Mapping V2 #4690

Merged
merged 45 commits into from
Mar 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
3d5760a
implement size bucket filtration logic
Fawke Nov 25, 2019
d8c96fc
Merge branch 'master' of https://github.com/prebid/Prebid.js into adv…
Fawke Nov 25, 2019
240cfce
finish implmenation of getFilteredMediaTypes
Fawke Nov 26, 2019
8d7d35d
implement getBids function
Fawke Dec 2, 2019
5264373
log useful information to the console
Fawke Dec 2, 2019
ac0007d
enable test workflow
Fawke Dec 2, 2019
4b876a6
modify checkAdUnitSetup function to account for the new sizeConfig ob…
Fawke Dec 4, 2019
c7b3816
remove unrelated example
Fawke Dec 5, 2019
751ceff
add decider function to choose between sizeMapping v1 and sizeMapping v2
Fawke Dec 6, 2019
cbf2a61
add getBidsHook for s2s bidders
Fawke Dec 6, 2019
60847f0
handle edge case where all mediaTypes get filtered out and the case w…
Fawke Dec 6, 2019
5c35aed
add test examples for banner media type
Fawke Dec 7, 2019
ca521ba
update label check to pick up the fist label operator instead of the …
Fawke Dec 7, 2019
9ca28cf
added example for label checks with banner ad
Fawke Dec 7, 2019
eeb07e7
add checkAdUnit setup hook on sizeMappingV2 modules to check presence…
Fawke Dec 8, 2019
0d6e27c
restore old hello world example
Fawke Dec 8, 2019
208861a
give free pass to video mediaTypes configured with sizeConfig propert…
Fawke Dec 8, 2019
bbb1888
fixing minor bus and enchancing bidder level sizeConfig checks
Fawke Dec 8, 2019
72b5607
bugfix: checkBidderSizeConfigFormat
Fawke Dec 8, 2019
d554866
add more scenarios for testing sizeMapping V2
Fawke Dec 8, 2019
ff0d348
small docs changes
Fawke Dec 8, 2019
0c30a75
feedback1 changes
Fawke Dec 11, 2019
613a830
modify logic for bailing out
Fawke Dec 12, 2019
4040fad
add module description
Fawke Dec 12, 2019
1efc71c
refactor isUsingNewSizeMapping function by making it a pure function
Fawke Dec 13, 2019
723c298
add unit test case for isUsingNewSizeMapping function
Fawke Dec 13, 2019
043626d
sync with master
Fawke Dec 13, 2019
4c20b1b
made adUnit checks more robusts and fully make adUnit.mediaTypes mand…
Fawke Dec 13, 2019
f0a29ca
remove redundancy in checAdUnitSetupHook
Fawke Dec 17, 2019
2165a8b
add banner units test cases for checkAdUnitSetupHook function
Fawke Dec 19, 2019
5afc8d1
add video and native mediaTypes units test for checkAdUnitSetupHook f…
Fawke Dec 20, 2019
66a43c5
rewrite some of the log messages
Fawke Dec 26, 2019
b4cf490
redefine log messages to make it simple to the end user
Fawke Dec 26, 2019
57c27e6
code optimization done so that getFilteredMediaTypes function gets ca…
Fawke Dec 31, 2019
aa65876
add code comments
Fawke Dec 31, 2019
7a02628
code refactorization and more unit test cases
Fawke Jan 2, 2020
72b69df
more unit tests for getBids function
Fawke Jan 3, 2020
ce36722
add sizeMapping usage example
Fawke Jan 4, 2020
47289a5
Merge branch 'master' of https://github.com/prebid/Prebid.js into adv…
Fawke Jan 4, 2020
8554891
delete sizeMappingV2 directory
Fawke Jan 4, 2020
f872991
add doctype declaration
Fawke Jan 7, 2020
79d8b16
fix LGTM alert and revert changes to pbjs_api.spec.js
Fawke Jan 8, 2020
aa53ccc
fix LGTM alerts in sizeMappingV2_spec file
Fawke Jan 8, 2020
49b7640
Merge branch 'master' into module-sizeMappingV2
Fawke Mar 3, 2020
b41fca8
add file extension for imports
Fawke Mar 3, 2020
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
121 changes: 121 additions & 0 deletions integrationExamples/gpt/responsiveAds_sizeMappingV2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<!DOCTYPE html>
<html>

<head>
<script async src="../../../build/dev/prebid.js"></script>
<script async src="https://www.googletagservices.com/tag/js/gpt.js"></script>
<script>
const FAILSAFE_TIMEOUT = 3300;
const PREBID_TIMEOUT = 1000;

const adUnits = [{
code: 'div-gpt-ad-1460505748561-0',
mediaTypes: {
banner: {
sizeConfig: [
{ minViewPort: [0, 0], sizes: [] }, // remove if < 750px
{ minViewPort: [750, 0], sizes: [[300, 250], [300, 600]] }, // between 750px and 1199px
{ minViewPort: [1200, 0], sizes: [[970, 90], [728, 90], [300, 250]] }, // between 1200px and 1599px
{ minViewPort: [1600, 0], sizes: [[1000, 300], [970, 90], [728, 90], [300, 250]] } // greater than 1600px
]
},
video: {
context: 'instream',
sizeConfig: [
{ minViewPort: [0, 0], playerSize: [] },
{ minViewPort: [800, 0], playerSize: [640, 480] }
]
},
native: {
image: {
required: true,
sizes: [150, 50]
},

sizeConfig: [
{ minViewPort: [0, 0], active: false },
{ minViewPort: [600, 0], active: true }
]
}
},
bids: [{
bidder: 'appnexus',
params: {
placementId: 13144370
},
sizeConfig: [
{ minViewPort: [0, 0], relevantMediaTypes: ['none'] },
{ minViewPort: [850, 0], relevantMediaTypes: ['banner'] }
]
}, {
bidder: 'rubicon',
params: {
accountId: 14062,
siteId: 70608,
zoneId: 498816
},
sizeConfig: [
{ minViewPort: [0, 0], relevantMediaTypes: ['none'] },
{ minViewPort: [850, 0], relevantMediaTypes: ['native'] },
{ minViewPort: [1200, 0], relevantMediaTypes: ['none'] }
]
}]
}];
var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];

</script>

<script>
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
googletag.cmd.push(function () {
googletag.pubads().disableInitialLoad();
});

pbjs.que.push(function () {
pbjs.addAdUnits(adUnits);
pbjs.requestBids({
bidsBackHandler: sendAdserverRequest,
timeout: PREBID_TIMEOUT
});
});

function sendAdserverRequest() {
if (pbjs.adserverRequestSent) return;
pbjs.adserverRequestSent = true;
googletag.cmd.push(function () {
pbjs.que.push(function () {
pbjs.setTargetingForGPTAsync();
googletag.pubads().refresh();
});
});
}

setTimeout(function () {
sendAdserverRequest();
}, FAILSAFE_TIMEOUT);

</script>

<script>
googletag.cmd.push(function () {
googletag.defineSlot('/19968336/header-bid-tag-0', [728, 90], 'div-gpt-ad-1460505748561-0').addService(googletag.pubads());

googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>
</head>

<body>
<h2>Prebid.js Test</h2>
<h5>Div-1</h5>
<div id='div-gpt-ad-1460505748561-0'>
<script type='text/javascript'>
googletag.cmd.push(function () { googletag.display('div-gpt-ad-1460505748561-0'); });
</script>
</div>
</body>

</html>
2 changes: 1 addition & 1 deletion modules/adpod.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ export function checkAdUnitSetupHook(fn, adUnits) {

let errMsg = `Detected missing or incorrectly setup fields for an adpod adUnit. Please review the following fields of adUnitCode: ${adUnit.code}. This adUnit will be removed from the auction.`;

let playerSize = !!(videoConfig.playerSize && utils.isArrayOfNums(videoConfig.playerSize));
let playerSize = !!((videoConfig.playerSize && utils.isArrayOfNums(videoConfig.playerSize)) || (videoConfig.sizeConfig));
let adPodDurationSec = !!(videoConfig.adPodDurationSec && utils.isNumber(videoConfig.adPodDurationSec) && videoConfig.adPodDurationSec > 0);
let durationRangeSec = !!(videoConfig.durationRangeSec && utils.isArrayOfNums(videoConfig.durationRangeSec) && videoConfig.durationRangeSec.every(range => range > 0));

Expand Down
Loading