Skip to content

Commit

Permalink
Between: fix sizes format & update readme.md (#5168)
Browse files Browse the repository at this point in the history
Co-authored-by: Ignat Khaylov <khaylov@betweenx.com>
  • Loading branch information
ignat-one and Ignat Khaylov authored Apr 29, 2020
1 parent a88ff90 commit f244450
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 71 deletions.
2 changes: 1 addition & 1 deletion modules/betweenBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const spec = {

validBidRequests.forEach(i => {
let params = {
sizes: parseSizesInput(getAdUnitSizes(i)),
sizes: parseSizesInput(getAdUnitSizes(i)).join('%2C'),
jst: 'hb',
ord: Math.random() * 10000000000000000,
tz: getTz(),
Expand Down
191 changes: 122 additions & 69 deletions modules/betweenBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,94 +8,147 @@ Maintainer: info@betweendigital.com

You can use this adapter to get a bid from betweendigital.

About us : http://betweendigital.com
About us : [betweenx.com](https://betweenx.com)

More detailed instructions you can be found on [this page](https://cdn.betweendigital.com/prebid_instructions/index.html) .

# Test Parameters

> The parameters are used as an example:
> s: 3649326 — Between section id; code: ad_slot — id of an iframe element showing prebid ads
```javascript
var adUnits = [
{
code: 'ad_slot',
mediaTypes: {
banner: {
sizes: [[970, 250], [240, 400], [728, 90]]
}
},
bids: [
{
bidder: "between",
params: {
s: 122938
}
}
]
}
];
var adUnits = [
{
code: "ad_slot",
mediaTypes: {
banner: {
sizes: [[240, 400]],
},
},
bids: [
{
bidder: "between",
params: {
s: 3649326,
},
},
],
},
];
```

Where:
### Multisizes

* s - the section id
* code - the id of the iframe tag to which the ads will be rendered
If you specify several sizes in the AdUnits settings in the **mediaTypes.banner.sizes** field, our SSP server will hold an auction with each size and respond with a bid with the maximum CPM.

# Example page
For example, your ad-slot supports three sizes: 970x250, 728x90 and 468x60. Then the AdUnits code will look like this:

```html
<html>
<head>
<script src="prebid.js"></script>
<script>
var PREBID_TIMEOUT = 700;
var adUnits = [{
code: 'example',
mediaTypes: {
banner: {
sizes: [[970, 250], [240, 400], [728, 90]]
}
},
bids: [{
bidder: 'between',
params: {
s: 809832
}
}]
```javascript
var adUnits = [{
code: 'ad-slot',
mediaTypes: {
banner: {
sizes: [[970, 250], [728, 90], [468, 60]]
}
},
bids: [
{
bidder: 'between',
params: {
s: BETWEEN_SECTION_ID,
}
}
]
}];
```

### Currency

}];
You can choose in which currency the SSP server will send cpm: 'RUB', 'USD' or 'EUR'. Default is 'RUB'. To do this, in the params field of our adapter you need to add the cur field, which takes one of the values: 'RUB', 'USD' or 'EUR'.

var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];
For example, you want CPM to be sent in dollars. Then the code of our adapter settings will look like this:

</script>
```javascript
{
bidder: 'between',
params: {
s: BETWEEN_SECTION_ID,
cur: 'USD'
}
}
```

### GDPR

<script>
pbjs.que.push(function() {
pbjs.setConfig({ userSync: {
iframeEnabled: true
}});
pbjs.addAdUnits(adUnits);
pbjs.requestBids({
bidsBackHandler: function(e) {
if (pbjs.adserverRequestSent) return;
pbjs.adserverRequestSent = true;
Also, we support GDPR. To find out how to use GDPR in Prebid you can visit [this page](http://prebid.org/dev-docs/modules/consentManagement.html)

var params = pbjs.getAdserverTargetingForAdUnitCode("example");
var iframe = document.getElementById('example');
var iframeDoc = iframe.contentWindow.document;

if(params && params['hb_adid']) {
pbjs.renderAd(iframeDoc, params['hb_adid']);
}
# Example page

```html
<html>
<head>
<script src="prebid.js"></script>
<script>
var PREBID_TIMEOUT = 700;
var adUnits = [
{
code: "example",
mediaTypes: {
banner: {
sizes: [
[970, 250],
[240, 400],
[728, 90],
],
},
},
bids: [
{
bidder: "between",
params: {
s: 809832,
},
},
],
},
];
var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];
</script>

<script>
pbjs.que.push(function () {
pbjs.setConfig({
userSync: {
iframeEnabled: true,
},
});
pbjs.addAdUnits(adUnits);
pbjs.requestBids({
bidsBackHandler: function (e) {
if (pbjs.adserverRequestSent) return;
pbjs.adserverRequestSent = true;
var params = pbjs.getAdserverTargetingForAdUnitCode("example");
var iframe = document.getElementById("example");
var iframeDoc = iframe.contentWindow.document;
if (params && params["hb_adid"]) {
pbjs.renderAd(iframeDoc, params["hb_adid"]);
}
});
},
});
</script>
});
</script>
</head>

<body>
<h2>Prebid.js BetweenBidAdapter Test</h2>
<iframe id="example"></iframe>
<h2>Prebid.js BetweenBidAdapter Test</h2>
<iframe id="example"></iframe>
</body>
</html>
```
</html>
```
2 changes: 1 addition & 1 deletion test/spec/modules/betweenBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,6 @@ describe('betweenBidAdapterTests', function () {
let request = spec.buildRequests(bidRequestData);
let req_data = request[0].data;

expect(req_data.sizes).to.deep.equal(['970x250', '240x400', '728x90']);
expect(req_data.sizes).to.deep.equal('970x250%2C240x400%2C728x90');
});
});

0 comments on commit f244450

Please sign in to comment.