-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Vendor Registration: Integrating BidGear Ad Networks into amp-ad (#…
…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
Showing
6 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters