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

OpenWrap V20.5.0 #409

Merged
merged 115 commits into from
Oct 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
8513f13
Increment pre version
robertrmartinez Aug 20, 2020
32066aa
module rule documentation updates (#5619)
bretg Aug 22, 2020
29bd8de
Add sspBC adapter (#5531)
wojciech-bialy-wpm Aug 24, 2020
b26bfe3
[IdentityLinkIdSystem] - pass tcfv2 consent string to envelope api (#…
NemanjaRajkovic9 Aug 24, 2020
01f4b28
Fix bug and add tests to catch next time (#5656)
robertrmartinez Aug 24, 2020
7001a23
Update vidazooBidAdapter_spec.js (#5639)
patmmccann Aug 25, 2020
71ff934
Add smartxBidAdapter (#5275)
smartclip-adtech Aug 25, 2020
e2c4e69
Add GDPR parameters to yieldlab delivery adtag (#5658)
mirkorean Aug 26, 2020
eb1aea4
Change ironsource to be lower case all over code (#5649)
liranbaruch Aug 26, 2020
347be07
aniviewBidAdapter - update renderer config (#5636)
itaynave Aug 26, 2020
353d2c4
yuktamedia Analytics Adapter: added pageViewId, language & refererInf…
AbhijitBhosale72 Aug 26, 2020
d38b5d0
fixed running of single spec file (#5648)
monis0395 Aug 26, 2020
a234c87
RP Bid Adapter read user.id (#5666)
Aug 26, 2020
aaae81f
add bidResponse object to cpmAdjustment calculator (#5609)
robertrmartinez Aug 26, 2020
ae956be
RP Bid Adapter: Use EID data set from userId/eids.js (#5657)
Aug 27, 2020
4274342
Prebid 4.5.0 Release
mike-chowla Aug 27, 2020
3f0ae07
Increment pre version
mike-chowla Aug 27, 2020
2b05803
qcadapter - tcf2 remove germany specific logic (#5664)
SleimanJneidi Aug 28, 2020
3d4e25d
merkleId Identity submodule submission (#5577)
angelamerkelprebid Aug 28, 2020
2d3b3bd
Added schain support and usersync output to cpmstarBidAdapter (#5660)
JoshuaMGoldstein Aug 28, 2020
6c41243
OpenX: Analytics Adapter update (#5449)
jimee02 Aug 31, 2020
a2f2ac6
Update rubiconAnalyticsAdapter.js with gvlid (#5681)
patmmccann Aug 31, 2020
e4bfe40
SpotX: Set ad_mute correctly. (#5486)
nathan-lapinski Aug 31, 2020
d642ebe
[Synacormedia] Update bid url scheme (#5665)
coreykress Aug 31, 2020
c4c060e
Rubicon Bid Adapter: fix incorrect sharedid param (#5671)
Aug 31, 2020
6af92be
Add native support to ablida Bid Adapter (#5545)
Sep 1, 2020
d90642d
update parameter field from consentManagement iframe call (#5505)
jsnellbaker Sep 1, 2020
c8a6010
remove cmpuishown event for tcf2 logic (#5642)
jsnellbaker Sep 1, 2020
0e054a5
bug sync RA (#5678)
richaudience Sep 2, 2020
badaab8
ATS-analytics - add gvlid property (#5672)
mamatic Sep 2, 2020
bafa139
Automatad Bid Adapter: Fix built request json to support multiple bid…
Sep 2, 2020
cb3a3b3
Fix typo in warning (#5682)
patmmccann Sep 2, 2020
bb18807
Price Floors: Fix bug when caching floor lookup (#5673)
robertrmartinez Sep 2, 2020
bba4b02
smartxBidAdapter.js - removed unused variables, removed debug, added …
smartclip-adtech Sep 2, 2020
6842e8b
Prebid 4.6.0 Release
Sep 2, 2020
e783c75
Increment pre version
Sep 2, 2020
deb7d5b
parrableIdSystem: Add an optional timezone and timezone offset allow/…
icflournoy Sep 3, 2020
7743713
Blue Billywig bid adapter update (#5584)
K-JBoon Sep 4, 2020
9626398
Vidazoo Adapter: refactor/user-sync (#5654)
uditalias Sep 5, 2020
783a3bb
New Bid Adapter: a4g (#5688)
Junus Sep 7, 2020
cacb5eb
Adding errors event listener (#5563)
ofirpaBrowsi Sep 8, 2020
33e1691
Prebid 4.7.0 Release
smenzer Sep 8, 2020
bcf7b5a
added adapters for gjirafa and malltv (#5587)
drilon-kastrati Sep 8, 2020
c3c04f5
minor validation update to consentManagement.js (#5701)
harpere Sep 8, 2020
44a3797
New Bid Adapter: decenterads (#5711)
vlaktion Sep 8, 2020
1676c76
fix GPT Pre-Auction PBS path (#5650)
Sep 8, 2020
22ce19f
Increment pre version
smenzer Sep 8, 2020
d41a946
Merge branch 'master' of github.com:prebid/Prebid.js
smenzer Sep 8, 2020
0d3c632
GumGumBidAdapter: Add support for multiple sizes (#5626)
estavillo Sep 8, 2020
05283d0
Add host to gulpfile (#5710)
VasekProchazka Sep 9, 2020
b96c1cc
Move test and publisherId parameters to bidder specific config (#5692)
frstua Sep 9, 2020
3726fd6
fix userId_example.html (#5606)
shikhar-dev-proj Sep 9, 2020
3c9e42f
MediaNet SChain Support (#5685)
c3p-0 Sep 9, 2020
b071457
PubWise.io Analytics Module Update - SPOT Support, Module Rules & Min…
GLStephen Sep 9, 2020
565d329
update amx bid adapter (#5605)
nickjacob Sep 9, 2020
85cf495
Add Pub-X Bid adapter (#5676)
Pub-X Sep 9, 2020
9a92a22
New adapter "Cointraffic" added (#5695)
stsepelin Sep 9, 2020
a2da917
Send GDPR data in analytics request (#5653)
bjorn-lw Sep 10, 2020
8f249dc
GDPR Enforcement - Bugfix (#5686)
Fawke Sep 10, 2020
2acca6f
changes SameSite from None to Lax for tests on Chrome 85.0.4183 which…
bansawbanchee Sep 10, 2020
c01cab1
implement issue #5687 (#5716)
robertrmartinez Sep 10, 2020
466b49e
allow publisher to define backup renderer (#5638)
patmmccann Sep 10, 2020
22bb758
Automatad Bid Adapter: Support multiple bids in response (#5699)
Sep 10, 2020
277fb9b
Fix: check mandatory video params (#5470)
cabama Sep 10, 2020
3c6e075
add verizon alias to aol (#5722)
ETNOL Sep 11, 2020
ba8ef86
Add prebid version to ad-server call (#5730)
arconamagi Sep 11, 2020
1e9be73
Zeotap ID+ submodule (#5640)
shikharsharma-zeotap Sep 11, 2020
896cc0f
Prebid Server returns exp rather than ttl (#5715)
bretg Sep 11, 2020
65b8dc0
Update the checking rule of bid param for bridgewellBidAdapter (#5736)
rigelbibi Sep 14, 2020
fd38cff
Add gvlid (#5737)
GLStephen Sep 14, 2020
0bd72ab
Triplelift: fpd and advertiser name support (#5731)
colbertk Sep 14, 2020
1e065e4
Package Lock Should Match Package.json (#5734)
GLStephen Sep 14, 2020
1704572
PubMatic BidAdapter: pass auctionId as default value for wiid param (…
pm-harshad-mane Sep 14, 2020
30a069c
Audigent HaloID User Id System Module (#5524)
antlauzon Sep 15, 2020
7da0521
Fix typo in TheMediaGrid Bid Adapter (#5589)
TheMediaGrid Sep 15, 2020
183ff52
Check localstorage availability before accessing it (#5616)
Swiiip Sep 15, 2020
f61be0c
Add Supply Supply Chain Object Module support for Yieldlab Adapter (#…
mirkorean Sep 15, 2020
cb733da
Livewrapped support for video (#5724)
bjorn-lw Sep 15, 2020
04ea603
Intentiq id value change (#5746)
yuvalgg Sep 16, 2020
298139f
add quantcast ID submodule (#5727)
mckurt Sep 16, 2020
bce32dc
upgrade ci resource (#5725)
Fawke Sep 16, 2020
140a67c
Rubicon analytics v2 (#5698)
robertrmartinez Sep 16, 2020
fd9a0d4
Add gdpr support to ablida bid adapter (#5741)
Sep 16, 2020
a3aa5f4
added onBidWon event (#5679)
adxpremium Sep 16, 2020
9452050
mapping spotx dealid to bid object (#5745)
khatibda Sep 16, 2020
bfb182a
fix broken unit tests for zeotap (#5758)
robertrmartinez Sep 16, 2020
a2c6128
Add guideline to check for GVL ID (#5757)
Fawke Sep 17, 2020
172980b
Added instream BID_WON tracking (#5481)
monis0395 Sep 17, 2020
db225e9
feat: add getEvents method to the public API (#5703)
gpolaert Sep 17, 2020
5911c6e
Prebid 4.8.0 Release
robertrmartinez Sep 17, 2020
cd4d0d8
Increment pre version
robertrmartinez Sep 17, 2020
89d829f
【MediaGoBidderAdapter】notify server if the page is secure and check m…
SylviaF Sep 18, 2020
6480715
ConnectAd Update: gvlid, better bidfloor support, transform type for …
rtuschkany Sep 19, 2020
743d6fc
No bid version 1.2.8 (#5630)
redaguermas Sep 21, 2020
f1793d3
adds support for zone and pubId params (#5728)
susyt Sep 21, 2020
e7501a9
Change the data type of gdpr and schain object in Payload (#5770)
thuyhq Sep 21, 2020
8ef4f9d
Update Openx analytics adapter (#5761)
kenan-gillet Sep 21, 2020
7c9c60d
Only set dimensions if can be resolved (#5769)
robertrmartinez Sep 21, 2020
b211409
Native support for Logicad adapter (#5742)
yuki-tsuchiya Sep 21, 2020
9297612
welect: update parameters to match backend specs of tcf2.0 (#5613)
nduitz Sep 22, 2020
52ff5e6
Initial checkin jixie adapter files (#5751)
jxdeveloper1 Sep 22, 2020
c210287
Rubicon Bid Adapter: Let host be configurable (#5779)
robertrmartinez Sep 22, 2020
4bddb0b
Rubicon Analytics Adapter: Custom Key Value reporting (#5778)
robertrmartinez Sep 22, 2020
b3e81e4
Prebid 4.9.0 Release
jsnellbaker Sep 22, 2020
f89af84
automate-creation of modules.json file
pm-pramod-pisal Sep 23, 2020
509033d
Merge branch 'prebid_upgrade_4_9_0_20200923150031' into test_br_b2_20…
pm-shashank-jain Sep 23, 2020
41f489b
Merge pull request #408 from PubMatic-OpenWrap/test_br_b2_20200923150032
pm-shashank-jain Sep 23, 2020
d6e208e
fixes for dfp
pm-shashank-jain Sep 23, 2020
1d9ea66
removed audienceNetwork from modules.json
pm-shashank-jain Sep 24, 2020
ddb104b
Fix for UOE-5694
pm-shashank-jain Sep 29, 2020
c966f54
Fix for test cases
pm-shashank-jain Sep 29, 2020
5746b4d
Merge branch 'nightly' of https://github.com/PubMatic-OpenWrap/Prebid…
pm-shashank-jain Sep 29, 2020
1d673a9
Merge branch 'prebid_upgrade_4_9_0_20200923150031' of https://github.…
pm-shashank-jain Sep 29, 2020
dd9e45d
regex support
pm-harshad-mane Sep 30, 2020
f1aae1a
Merge pull request #410 from PubMatic-OpenWrap/pm_analytics_regex
pm-shashank-jain Oct 5, 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
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ aliases:
docker:
# specify the version you desire here
- image: circleci/node:12.16.1
resource_class: xlarge
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
Expand Down Expand Up @@ -94,4 +94,4 @@ workflows:
- e2etest

experimental:
pipelines: true
pipelines: true
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ master branch.
Pull requests must have 80% code coverage before beign considered for merge.
Additional details about the process can be found [here](./PR_REVIEW.md).

There are more details available if you'd like to contribute a [bid adapter](https://docs.prebid.org/dev-docs/bidder-adaptor.html) or [analytics adapter](https://docs.prebid.org/dev-docs/integrate-with-the-prebid-analytics-api.html).

## Issues
[prebid.org](http://prebid.org/) contains documentation that may help answer questions you have about using Prebid.js.
If you can't find the answer there, try searching for a similar issue on the [issues page](https://github.com/prebid/Prebid.js/issues).
Expand Down
24 changes: 12 additions & 12 deletions PR_REVIEW.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ For modules and core platform updates, the initial reviewer should request an ad
- Review for obvious errors or bad coding practice / use best judgement here.
- If the change is a new feature / change to core prebid.js - review the change with a Tech Lead on the project and make sure they agree with the nature of change.
- If the change results in needing updates to docs (such as public API change, module interface etc), add a label for "needs docs" and inform the submitter they must submit a docs PR to update the appropriate area of Prebid.org **before the PR can merge**. Help them with finding where the docs are located on prebid.org if needed.
- Below are some examples of bidder specific updates that should require docs update (in their dev-docs/bidders/bidder.md file):
- Below are some examples of bidder specific updates that should require docs update (in their dev-docs/bidders/BIDDER.md file):
- If they support the GDPR consentManagement module and TCF1, add `gdpr_supported: true`
- If they support the GDPR consentManagement module and TCF2, add `tcf2_supported: true`
- If they support the US Privacy consentManagementUsp module, add `usp_supported: true`
Expand All @@ -23,7 +23,8 @@ For modules and core platform updates, the initial reviewer should request an ad
- If they support COPPA, add `coppa_supported: true`
- If they support SChain, add `schain_supported: true`
- If their bidder doesn't work well with safeframed creatives, add `safeframes_ok: false`. This will alert publishers to not use safeframed creatives when creating the ad server entries for their bidder.
- If they're a member of Prebid.org, add `prebid_member: true`
- If they're setting a deal ID in some scenarios, add `bidder_supports_deals: true`
- If they have an IAB Global Vendor List ID, add `gvl_id: ID`. There's no default.
- If all above is good, add a `LGTM` comment and request 1 additional core member to review.
- Once there is 2 `LGTM` on the PR, merge to master
- Ask the submitter to add a PR for documentation if applicable.
Expand All @@ -34,18 +35,17 @@ For modules and core platform updates, the initial reviewer should request an ad
- Follow steps above for general review process. In addition, please verify the following:
- Verify that bidder has submitted valid bid params and that bids are being received.
- Verify that bidder is not manipulating the prebid.js auction in any way or doing things that go against the principles of the project. If unsure check with the Tech Lead.
- Verify that the bidder is being as efficient as possible, ideally not loading an external library, however if they do load a library it should be cached.
- Verify that code re-use is being done properly and that changes introduced by a bidder don't impact other bidders.
- If the adapter being submitted is an alias type, check with the bidder contact that is being aliased to make sure it's allowed.
- If the adapter is triggering any user syncs make sure they are using the user sync module in the Prebid.js core.
- Requests to the bidder should support HTTPS
- Responses from the bidder should be compressed (such as gzip, compress, deflate)
- Bid responses may not use JSONP: All requests must be AJAX with JSON responses
- Video openrtb params should be read from the ad unit when available; however bidder config can override the ad unit.
- All user-sync (aka pixel) activity must be registered via the provided functions
- Adapters may not use the $$PREBID_GLOBAL$$ variable
- All adapters must support the creation of multiple concurrent instances. This means, for example, that adapters cannot rely on mutable global variables.
- Adapters may not globally override or default the standard ad server targeting values: hb_adid, hb_bidder, hb_pb, hb_deal, or hb_size, hb_source, hb_format.
- All required global and bidder-adapter rules defined in the [Module Rules](https://docs.prebid.org/dev-docs/module-rules.html) must be followed. Please review these rules often - we depend on reviewers to enforce them.
- All bidder parameter conventions must be followed:
- Video params must be read from AdUnit.mediaTypes.video when available; however bidder config can override the ad unit.
- First party data must be read from [`fpd.context` and `fpd.user`](https://docs.prebid.org/dev-docs/publisher-api-reference.html#setConfig-fpd).
- Adapters that accept a floor parameter must also support the [floors module](https://docs.prebid.org/dev-docs/modules/floors.html) -- look for a call to the `getFloors()` function.
- Adapters cannot accept an schain parameter. Rather, they must look for the schain parameter at bidRequest.schain.
- The bidRequest page referrer must checked in addition to any bidder-specific parameter.
- If they're getting the COPPA flag, it must come from config.getConfig('coppa');

- After a new adapter is approved, let the submitter know they may open a PR in the [headerbid-expert repository](https://github.com/prebid/headerbid-expert) to have their adapter recognized by the [Headerbid Expert extension](https://chrome.google.com/webstore/detail/headerbid-expert/cgfkddgbnfplidghapbbnngaogeldmop). The PR should be to the [bidder patterns file](https://github.com/prebid/headerbid-expert/blob/master/bidderPatterns.js), adding an entry with their adapter's name and the url the adapter uses to send and receive bid responses.

## Ticket Coordinator
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,17 +268,15 @@ As you make code changes, the bundles will be rebuilt and the page reloaded auto

## Contribute

Many SSPs, bidders, and publishers have contributed to this project. [60+ Bidders](https://github.com/prebid/Prebid.js/tree/master/src/adapters) are supported by Prebid.js.
Many SSPs, bidders, and publishers have contributed to this project. [Hundreds of bidders](https://github.com/prebid/Prebid.js/tree/master/src/adapters) are supported by Prebid.js.

For guidelines, see [Contributing](./CONTRIBUTING.md).

Our PR review process can be found [here](https://github.com/prebid/Prebid.js/tree/master/PR_REVIEW.md).

### Add a Bidder Adapter

To add a bidder adapter module, see the instructions in [How to add a bidder adaptor](http://prebid.org/dev-docs/bidder-adaptor.html).

Please **do NOT load Prebid.js inside your adapter**. If you do this, we will reject or remove your adapter as appropriate.
To add a bidder adapter module, see the instructions in [How to add a bidder adapter](https://docs.prebid.org/dev-docs/bidder-adaptor.html).

### Code Quality

Expand Down
1 change: 1 addition & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ function watch(done) {
connect.server({
https: argv.https,
port: port,
host: FAKE_SERVER_HOST,
root: './',
livereload: true
});
Expand Down
43 changes: 37 additions & 6 deletions integrationExamples/gpt/userId_example.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@
var adUnits = [
{
code: 'test-div',
sizes: [[300,250],[300,600],[728,90]],
mediaTypes: {
banner: {
sizes: [[300,250],[300,600],[728,90]]
}
},
bids: [
{
bidder: 'rubicon',
Expand Down Expand Up @@ -115,7 +119,7 @@
consentManagement: {
cmpApi: 'iab',
timeout: 1000,
allowAuctionWithoutConsent: true
defaultGdprScope: true
},
// consentManagement: {
// cmpApi: 'static',
Expand All @@ -128,7 +132,7 @@
// }
// }
// },
usersync: {
userSync: {
userIds: [{
name: "unifiedId",
params: {
Expand Down Expand Up @@ -164,6 +168,18 @@
},

}, {
name: "merkleId",
params: {
ptk: '12345678-aaaa-bbbb-cccc-123456789abc', //Set your real merkle partner key here
pubid: 'EXAMPLE' //Set your real merkle publisher id here
},
storage: {
type: "html5",
name: "merkleId",
expires: 30
},

},{
name: "parrableId",
params: {
// change to Parrable Partner Client ID(s) you received from the Parrable Partners you are using
Expand Down Expand Up @@ -201,10 +217,10 @@
name: "sharedid",
expires: 28
}
},
},
{
name: 'lotamePanoramaId'
},
},
{
name: "liveIntentId",
params: {
Expand All @@ -215,7 +231,22 @@
name: "_li_pbid",
expires: 28
}
}],
},
{
name: "zeotapIdPlus"
},
{
name: 'haloId',
storage: {
type: "cookie",
name: "haloId",
expires: 28
}
},
{
name: "quantcastId"
}
],
syncDelay: 5000,
auctionDelay: 1000
}
Expand Down
10 changes: 10 additions & 0 deletions karma.conf.maker.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,16 @@ module.exports = function(codeCoverage, browserstack, watchMode, file) {

plugins: plugins
}

// To ensure that, we are able to run single spec file
// here we are adding preprocessors, when file is passed
if (file) {
config.files.forEach((file) => {
config.preprocessors[file] = ['webpack', 'sourcemap'];
});
delete config.preprocessors['test/test_index.js'];
}

setReporters(config, codeCoverage, browserstack);
setBrowsers(config, browserstack);
return config;
Expand Down
2 changes: 1 addition & 1 deletion modules.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
["appnexusBidAdapter","consentManagement","sekindoUMBidAdapter","pulsepointBidAdapter","openxBidAdapter","rubiconBidAdapter","sovrnBidAdapter","pubmaticBidAdapter","adgenerationBidAdapter","pubmaticServerBidAdapter","ixBidAdapter","pubmaticAnalyticsAdapter"]
["appnexusBidAdapter","consentManagement","sekindoUMBidAdapter","pulsepointBidAdapter","openxBidAdapter","rubiconBidAdapter","sovrnBidAdapter","pubmaticBidAdapter","adgenerationBidAdapter","pubmaticServerBidAdapter","ixBidAdapter","criteoBidAdapter"]
7 changes: 6 additions & 1 deletion modules/.submodules.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,23 @@
"britepoolIdSystem",
"liveIntentIdSystem",
"lotamePanoramaId",
"merkleIdSystem",
"criteoIdSystem",
"netIdSystem",
"identityLinkIdSystem",
"sharedIdSystem",
"intentIqIdSystem"
"intentIqIdSystem",
"zeotapIdPlusIdSystem",
"haloIdSystem",
"quantcastIdSystem"
],
"adpod": [
"freeWheelAdserverVideo",
"dfpAdServerVideo"
],
"rtdModule": [
"browsiRtdProvider",
"audigentRtdProvider",
"jwplayerRtdProvider"
]
}
90 changes: 90 additions & 0 deletions modules/a4gBidAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import {registerBidder} from '../src/adapters/bidderFactory.js';
import * as utils from '../src/utils.js';

const A4G_BIDDER_CODE = 'a4g';
const A4G_CURRENCY = 'USD';
const A4G_DEFAULT_BID_URL = 'https://ads.ad4game.com/v1/bid';
const A4G_TTL = 120;

const LOCATION_PARAM_NAME = 'siteurl';
const ID_PARAM_NAME = 'id';
const IFRAME_PARAM_NAME = 'if';
const ZONE_ID_PARAM_NAME = 'zoneId';
const SIZE_PARAM_NAME = 'size';

const ARRAY_PARAM_SEPARATOR = ';';
const ARRAY_SIZE_SEPARATOR = ',';
const SIZE_SEPARATOR = 'x';

export const spec = {
code: A4G_BIDDER_CODE,
isBidRequestValid: function(bid) {
return bid.params && !!bid.params.zoneId;
},

buildRequests: function(validBidRequests, bidderRequest) {
let deliveryUrl = '';
const idParams = [];
const sizeParams = [];
const zoneIds = [];

utils._each(validBidRequests, function(bid) {
if (!deliveryUrl && typeof bid.params.deliveryUrl === 'string') {
deliveryUrl = bid.params.deliveryUrl;
}
idParams.push(bid.bidId);
let bidSizes = (bid.mediaTypes && bid.mediaTypes.banner && bid.mediaTypes.banner.sizes) || bid.sizes;
sizeParams.push(bidSizes.map(size => size.join(SIZE_SEPARATOR)).join(ARRAY_SIZE_SEPARATOR));
zoneIds.push(bid.params.zoneId);
});

if (!deliveryUrl) {
deliveryUrl = A4G_DEFAULT_BID_URL;
}

let data = {
[IFRAME_PARAM_NAME]: 0,
[LOCATION_PARAM_NAME]: (bidderRequest.refererInfo && bidderRequest.refererInfo.referer) ? bidderRequest.refererInfo.referer : window.location.href,
[SIZE_PARAM_NAME]: sizeParams.join(ARRAY_PARAM_SEPARATOR),
[ID_PARAM_NAME]: idParams.join(ARRAY_PARAM_SEPARATOR),
[ZONE_ID_PARAM_NAME]: zoneIds.join(ARRAY_PARAM_SEPARATOR)
};

if (bidderRequest && bidderRequest.gdprConsent) {
data.gdpr = {
applies: bidderRequest.gdprConsent.gdprApplies,
consent: bidderRequest.gdprConsent.consentString
};
}

return {
method: 'GET',
url: deliveryUrl,
data: data
};
},

interpretResponse: function(serverResponses, request) {
const bidResponses = [];
utils._each(serverResponses.body, function(response) {
if (response.cpm > 0) {
const bidResponse = {
requestId: response.id,
creativeId: response.id,
adId: response.id,
cpm: response.cpm,
width: response.width,
height: response.height,
currency: A4G_CURRENCY,
netRevenue: true,
ttl: A4G_TTL,
ad: response.ad
};
bidResponses.push(bidResponse);
}
});
return bidResponses;
}
};

registerBidder(spec);
18 changes: 13 additions & 5 deletions modules/a4gBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,40 @@ Maintainer: devops@ad4game.com

# Description

Ad4Game Bidder Adapter for Prebid.js. It should be tested on real domain. `localhost` should be rewritten (ex. example.com).
Ad4Game Bidder Adapter for Prebid.js. It should be tested on real domain. `localhost` should be rewritten (ex. example.com).

# Test Parameters
```
var adUnits = [
{
code: 'test-div',
sizes: [[300, 250]], // a display size
mediaTypes: {
banner: {
sizes: [[300, 250]], // a display size
}
},
bids: [
{
bidder: 'a4g',
params: {
zoneId: 59304,
deliveryUrl: 'http://dev01.ad4game.com/v1/bid'
deliveryUrl: 'https://dev01.ad4game.com/v1/bid'
}
}
]
},{
code: 'test-div',
sizes: [[300, 50]], // a mobile size
mediaTypes: {
banner: {
sizes: [[300, 50]], // a mobile size
}
},
bids: [
{
bidder: 'a4g',
params: {
zoneId: 59354,
deliveryUrl: 'http://dev01.ad4game.com/v1/bid'
deliveryUrl: 'https://dev01.ad4game.com/v1/bid'
}
}
]
Expand Down
Loading