Skip to content

Commit 253cbf4

Browse files
piotr-yuxuanmike-chowla
authored andcommitted
Improve emoteevBidAdapter (prebid#3673)
* Improve emoteevBidAdapter ** Squash several pending changes - Improve test coverage - Extreme programming: 100% test coverage - Document important constants - Extreme programming: document all functions - Imperative shell, functional core - Send events onBidWon and onTimeout - Report GDPR relevance and consent Code documentation uses JSDoc tags wherever possible. See the following link for general explanation of the notation used: https://github.com/google/closure-compiler/wiki/Annotating-JavaScript-for-the-Closure-Compiler ** Test coverage - 100% Statements 110/110 - 100% Branches 55/55 - 100% Functions 28/28 - 100% Lines 99/99 ** Integration tests Tested against production endpoint with the possible combinations of these following parameters: - Browser: · Chrome Canary 75.0.3739.0 · Firefox Developer Edition 67.0b3 (64-bit) · Safari version 12.0.3 (14606.4.5) · Tor Browser 8.0.6 (based on Mozilla Firefox 60.5.1esr) - Integration page: · integrationExamples/gpt/hello_world_emoteev.html · https://jsfiddle.net/8aqotw1k/6/ Localhost test server launched with: $ npm install && gulp serve * Tentative CI fix for IE and Edge webGL test https://circleci.com/gh/prebid/Prebid.js/2052 * Tentative CI fix for IE and Edge webGL test #2 * Give up on webGL tests Has anybody an idea to make it pass? https://circleci.com/gh/prebid/Prebid.js/2056 New test coverage: - 94.5% Statements 103/109 - 98.18% Branches 54/55 - 100% Functions 28/28 - 93.88% Lines 92/98 * Avoid useless noice in diff * Remove unallowed metric pixel ON_ADAPTER_CALLED
1 parent 1ef6197 commit 253cbf4

File tree

4 files changed

+1056
-386
lines changed

4 files changed

+1056
-386
lines changed

integrationExamples/gpt/hello_world_emoteev.html

+56-61
Original file line numberDiff line numberDiff line change
@@ -5,84 +5,79 @@
55
<script async src="//www.googletagservices.com/tag/js/gpt.js"></script>
66
<script type="text/javascript" src="../../build/dev/prebid.js" async></script>
77
<script>
8-
var sizes = [
9-
[300, 250],
10-
[250, 300],
11-
[300, 600]
12-
];
13-
var PREBID_TIMEOUT = 3000;
14-
var FAILSAFE_TIMEOUT = 3000;
8+
const sizes = [
9+
[300, 250],
10+
[250, 300],
11+
[300, 600]
12+
];
13+
const PREBID_TIMEOUT = 3000;
14+
const FAILSAFE_TIMEOUT = 3000;
1515

16-
var adUnits = [{
17-
code: '/19968336/header-bid-tag-1',
18-
mediaTypes: {
19-
banner: {
20-
sizes: sizes
21-
}
22-
},
23-
bids: [{
24-
bidder: 'emoteev',
25-
params: {
26-
adSpaceId: 5084,
27-
}
28-
}]
29-
}];
16+
const adUnits = [{
17+
code: '/19968336/header-bid-tag-1',
18+
mediaTypes: {
19+
banner: {
20+
sizes: sizes
21+
}
22+
},
23+
bids: [{
24+
bidder: 'emoteev',
25+
params: {
26+
adSpaceId: 5084,
27+
}
28+
}]
29+
}];
3030

31-
// ======== DO NOT EDIT BELOW THIS LINE =========== //
32-
var googletag = googletag || {};
33-
googletag.cmd = googletag.cmd || [];
34-
googletag.cmd.push(function () {
35-
googletag.pubads().disableInitialLoad();
36-
});
31+
// ======== DO NOT EDIT BELOW THIS LINE =========== //
32+
var googletag = googletag || {};
33+
googletag.cmd = googletag.cmd || [];
34+
googletag.cmd.push(function () {
35+
googletag.pubads().disableInitialLoad();
36+
});
3737

38-
var pbjs = pbjs || {};
39-
pbjs.que = pbjs.que || [];
38+
var pbjs = pbjs || {};
39+
pbjs.que = pbjs.que || [];
4040

41-
pbjs.que.push(function () {
42-
pbjs.addAdUnits(adUnits);
43-
pbjs.requestBids({
44-
bidsBackHandler: initAdserver,
45-
timeout: PREBID_TIMEOUT
46-
});
41+
pbjs.que.push(function () {
42+
pbjs.addAdUnits(adUnits);
43+
pbjs.requestBids({
44+
bidsBackHandler: initAdserver,
45+
timeout: PREBID_TIMEOUT
4746
});
47+
});
4848

49-
function initAdserver() {
50-
if (pbjs.initAdserverSet) return;
51-
pbjs.initAdserverSet = true;
52-
googletag.cmd.push(function () {
53-
pbjs.que.push(function () {
54-
pbjs.setTargetingForGPTAsync();
55-
googletag.pubads().refresh();
56-
});
57-
});
58-
}
59-
60-
61-
// in case PBJS doesn't load
62-
setTimeout(function () {
63-
console.log("prebid.js setTimeout");
64-
initAdserver();
65-
}, FAILSAFE_TIMEOUT);
66-
49+
function initAdserver() {
50+
if (pbjs.initAdserverSet) return;
51+
pbjs.initAdserverSet = true;
6752
googletag.cmd.push(function () {
68-
googletag.defineSlot('/19968336/header-bid-tag-1', sizes, 'div-1')
69-
.addService(googletag.pubads());
70-
googletag.pubads().enableSingleRequest();
71-
googletag.enableServices();
53+
pbjs.que.push(function () {
54+
pbjs.setTargetingForGPTAsync();
55+
googletag.pubads().refresh();
56+
});
7257
});
58+
}
7359

74-
</script>
60+
setTimeout(function () {
61+
initAdserver();
62+
}, FAILSAFE_TIMEOUT);
7563

64+
googletag.cmd.push(function () {
65+
googletag.defineSlot('/19968336/header-bid-tag-1', sizes, 'div-1')
66+
.addService(googletag.pubads());
67+
googletag.pubads().enableSingleRequest();
68+
googletag.enableServices();
69+
});
70+
</script>
7671
</head>
7772

7873
<body>
7974
<h2>Basic Prebid.js Example</h2>
8075
<h5>Div-1</h5>
8176
<div id='div-1'>
8277
<script type='text/javascript'>
83-
googletag.cmd.push(function () {
84-
googletag.display('div-1');
85-
});
78+
googletag.cmd.push(function () {
79+
googletag.display('div-1');
80+
});
8681

8782
</script>
8883
</div>

0 commit comments

Comments
 (0)