Skip to content

Commit

Permalink
✨ Vendor Registration: Integrating BidGear Ad Networks into amp-ad (#…
Browse files Browse the repository at this point in the history
…39946)

* Add Bidgear ad vendor for ads-amp

* Change example bidgear ads

* update alphabet config

* remove newline

* Fix lint bidgear.js

* Fix lint bidgear.js

* Fix lint bidgear.js
  • Loading branch information
tindvubg authored and eszponder committed Apr 22, 2024
1 parent 28fbb00 commit 98001a9
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 0 deletions.
12 changes: 12 additions & 0 deletions 3p/vendors/bidgear.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 {bidgear} from '#ads/vendors/bidgear';

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

window.draw3p = draw3p;
5 changes: 5 additions & 0 deletions ads/_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,11 @@ const adConfig = jsonConfiguration({
renderStartImplemented: true,
},

'bidgear': {
prefetch: 'https://platform.bidgear.com/bidgear-amp.js',
renderStartImplemented: true,
},

'bidtellect': {},

'blade': {
Expand Down
35 changes: 35 additions & 0 deletions ads/vendors/bidgear.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import {loadScript, validateData} from '#3p/3p';

const requiredParams = ['zoneid'];

/**
* @param {!Window} global
* @param {!Object} data
*/
export function bidgear(global, data) {
validateData(data, requiredParams);

const container = document.getElementById('c');
const adDivId = 'bg-ssp-' + encodeURIComponent(data.zoneid);
const adDiv = document.createElement('div');
adDiv.setAttribute('id', adDivId);
container.appendChild(adDiv);

loadScript(
global,
'https://platform.bidgear.com/bidgear-amp.js',
() => {
// Bidgear has been loaded
window.pubbidgeartag = window.pubbidgeartag || [];
window.pubbidgeartag.push({
zoneid: encodeURIComponent(data.zoneid),
id: encodeURIComponent(adDivId),
wu: window.location.href,
});
},
() => {
// Cannot load bidgear-amp.js
global.context.noContentAvailable();
}
);
}
22 changes: 22 additions & 0 deletions ads/vendors/bidgear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Bidgear

## Examples

```html
<amp-ad
width="300"
height="250"
type="bidgear"
data-zoneid="PLACE_HOLDER">
</amp-ad>
```

## Configuration

**Required:**

`width` + `height` - Required for all `<amp-ad>` units. Specifies the ad size.

`type` - Always set to "bidgear".

`data-zoneid`: Zone Id.
5 changes: 5 additions & 0 deletions examples/amp-ad/ads.amp.html
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@
<option>baidu</option>
<option>beaverads</option>
<option>beopinion</option>
<option>bidgear</option>
<option>bidtellect</option>
<option>blade</option>
<option>brainy</option>
Expand Down Expand Up @@ -849,6 +850,10 @@ <h2>BeaverAds</h2>
data-account="556f2afc6ebef601004fb60f">
</amp-ad>

<h2 id="bidgear">Bidgear</h2>
<amp-ad width="300" height="250" type="bidgear" data-zoneid="7795">
</amp-ad>

<h2 id="bidtellect">Bidtellect</h2>
<amp-ad width=320 height=200 type="bidtellect" data-t="20bc0442-8bec-43f8-9992-08be6e6a3591" data-pid="925847381"
data-sid="216072">
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 @@ -314,6 +314,7 @@ See [amp-ad rules](validator-amp-ad.protoascii) in the AMP validator specificati
- [Baidu](../../ads/vendors/baidu.md)
- [BeaverAds](../../ads/vendors/beaverads.md)
- [BeOpinion](../amp-beopinion/amp-beopinion.md)
- [Bidgear](../../ads/vendors/bidgear.md)
- [Bidtellect](../../ads/vendors/bidtellect.md)
- [Blade](../../ads/vendors/blade.md)
- [brainy](../../ads/vendors/brainy.md)
Expand Down

0 comments on commit 98001a9

Please sign in to comment.