-
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.
✨ [ads2.bid] amp-ad ads2bid implementation (#37501)
* amp-ad ads2bid implementation * amp-ad ads2bid implementation spaces
- Loading branch information
1 parent
a96927d
commit da7ed1f
Showing
7 changed files
with
72 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
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 {ads2bid} from '#ads/vendors/ads2bid'; | ||
|
||
init(window); | ||
register('ads2bid', ads2bid); | ||
|
||
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,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); | ||
} |
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,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> | ||
``` |
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