Skip to content

Commit

Permalink
Improve emoteevBidAdapter (#3673)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
piotr-yuxuan authored and mike-chowla committed Apr 22, 2019
1 parent 1ef6197 commit 253cbf4
Show file tree
Hide file tree
Showing 4 changed files with 1,056 additions and 386 deletions.
117 changes: 56 additions & 61 deletions integrationExamples/gpt/hello_world_emoteev.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,84 +5,79 @@
<script async src="//www.googletagservices.com/tag/js/gpt.js"></script>
<script type="text/javascript" src="../../build/dev/prebid.js" async></script>
<script>
var sizes = [
[300, 250],
[250, 300],
[300, 600]
];
var PREBID_TIMEOUT = 3000;
var FAILSAFE_TIMEOUT = 3000;
const sizes = [
[300, 250],
[250, 300],
[300, 600]
];
const PREBID_TIMEOUT = 3000;
const FAILSAFE_TIMEOUT = 3000;

var adUnits = [{
code: '/19968336/header-bid-tag-1',
mediaTypes: {
banner: {
sizes: sizes
}
},
bids: [{
bidder: 'emoteev',
params: {
adSpaceId: 5084,
}
}]
}];
const adUnits = [{
code: '/19968336/header-bid-tag-1',
mediaTypes: {
banner: {
sizes: sizes
}
},
bids: [{
bidder: 'emoteev',
params: {
adSpaceId: 5084,
}
}]
}];

// ======== DO NOT EDIT BELOW THIS LINE =========== //
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
googletag.cmd.push(function () {
googletag.pubads().disableInitialLoad();
});
// ======== DO NOT EDIT BELOW THIS LINE =========== //
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
googletag.cmd.push(function () {
googletag.pubads().disableInitialLoad();
});

var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];
var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];

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

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


// in case PBJS doesn't load
setTimeout(function () {
console.log("prebid.js setTimeout");
initAdserver();
}, FAILSAFE_TIMEOUT);

function initAdserver() {
if (pbjs.initAdserverSet) return;
pbjs.initAdserverSet = true;
googletag.cmd.push(function () {
googletag.defineSlot('/19968336/header-bid-tag-1', sizes, 'div-1')
.addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
pbjs.que.push(function () {
pbjs.setTargetingForGPTAsync();
googletag.pubads().refresh();
});
});
}

</script>
setTimeout(function () {
initAdserver();
}, FAILSAFE_TIMEOUT);

googletag.cmd.push(function () {
googletag.defineSlot('/19968336/header-bid-tag-1', sizes, 'div-1')
.addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>
</head>

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

</script>
</div>
Expand Down
Loading

0 comments on commit 253cbf4

Please sign in to comment.