Skip to content

Commit

Permalink
✨ [ads2.bid] amp-ad ads2bid implementation (#37501)
Browse files Browse the repository at this point in the history
* amp-ad ads2bid implementation

* amp-ad ads2bid implementation spaces
  • Loading branch information
github-profitclicks committed Jan 27, 2022
1 parent a96927d commit da7ed1f
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 0 deletions.
2 changes: 2 additions & 0 deletions 3p/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import {adplugg} from '#ads/vendors/adplugg';
import {adpon} from '#ads/vendors/adpon';
import {adpushup} from '#ads/vendors/adpushup';
import {adreactor} from '#ads/vendors/adreactor';
import {ads2bid} from '#ads/vendors/ads2bid';
import {adsensor} from '#ads/vendors/adsensor';
import {adservsolutions} from '#ads/vendors/adservsolutions';
import {adsloom} from '#ads/vendors/adsloom';
Expand Down Expand Up @@ -338,6 +339,7 @@ register('adpon', adpon);
register('adpushup', adpushup);
register('adreactor', adreactor);
register('adsensor', adsensor);
register('ads2bid', ads2bid);
register('adservsolutions', adservsolutions);
register('adsloom', adsloom);
register('adsnative', adsnative);
Expand Down
12 changes: 12 additions & 0 deletions 3p/vendors/ads2bid.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// src/polyfills.js must be the first import.
import '#3p/polyfills';

import {register} from '#3p/3p';
import {draw3p, init} from '#3p/integration-lib';

import {ads2bid} from '#ads/vendors/ads2bid';

init(window);
register('ads2bid', ads2bid);

window.draw3p = draw3p;
4 changes: 4 additions & 0 deletions ads/_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ const adConfig = jsonConfiguration({

'adreactor': {},

'ads2bid': {
renderStartImplemented: true,
},

'adsensor': {
prefetch: 'https://wfpscripts.webspectator.com/amp/adsensor-amp.js',
clientIdScope: 'amp_ecid_adensor',
Expand Down
22 changes: 22 additions & 0 deletions ads/vendors/ads2bid.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import {loadScript, validateData} from '#3p/3p';

/**
* @param {!Window} global
* @param {!Object} data
*/
export function ads2bid(global, data) {
validateData(data, ['blockId', 'siteId', 'src']);
const {blockId, siteId, src} = data;
const url = src + `/html/amp?site_id=${siteId}&blocks=${blockId}`;
createContainer(global);
loadScript(global, url);
}

/**
* @param {!Window} global
*/
function createContainer(global) {
const div = global.document.createElement('div');
div.setAttribute('data-ads2bid', 1);
global.document.getElementById('c').appendChild(div);
}
21 changes: 21 additions & 0 deletions ads/vendors/ads2bid.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# ads2.bid

Provides support for [ads2.bid](https://ads2.bid/) widgets.

### Required parameters

- `src`
- `data-block-id`
- `data-site-id`

## Example

```html
<amp-ad width="690"
height="690"
type="ads2bid"
data-site-id="11620"
data-block-id="123602,690"
src="https://kdunhltakb.ru">
</amp-ad>
```
10 changes: 10 additions & 0 deletions examples/amp-ad/ads.amp.html
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@
<option>adpon</option>
<option>adpushup</option>
<option>adreactor</option>
<option>ads2bid</option>
<option>adsense</option>
<option>adsensor</option>
<option>adservsolutions</option>
Expand Down Expand Up @@ -752,6 +753,15 @@ <h2>AdReactor</h2>
data-custom3="No Type">
</amp-ad>

<h2>Ads2bid</h2>
<amp-ad width="690"
height="690"
type="ads2bid"
data-site-id="11620"
data-block-id="123602,690"
src="https://kdunhltakb.ru">
</amp-ad>

<h2>AdSense</h2>
<amp-ad width="300" height="250"
type="adsense"
Expand Down
1 change: 1 addition & 0 deletions extensions/amp-ad/amp-ad.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ See [amp-ad rules](validator-amp-ad.protoascii) in the AMP validator specificati
- [Adpon](../../ads/vendors/adpon.md)
- [Adpushup](../../ads/vendors/adpushup.md)
- [AdReactor](../../ads/vendors/adreactor.md)
- [Ads2Bid](../../ads/vendors/ads2bid.md)
- [AdSense](../../ads/google/adsense.md)
- [AdSensor](../../ads/vendors/adsensor.md)
- [AdServSolutions](../../ads/vendors/adservsolutions.md)
Expand Down

0 comments on commit da7ed1f

Please sign in to comment.