Skip to content

Commit 82f501c

Browse files
✨ Playwire AMP-AD implementation (#40437)
* Set up Playwire amp-ad module * pass json attribute through * remove unused import * fix linting errors --------- Co-authored-by: Jarrett Abello <[email protected]>
1 parent ea70b30 commit 82f501c

File tree

6 files changed

+77
-0
lines changed

6 files changed

+77
-0
lines changed

3p/vendors/playwire.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// src/polyfills.js must be the first import.
2+
import '#3p/polyfills';
3+
4+
import {register} from '#3p/3p';
5+
import {draw3p, init} from '#3p/integration-lib';
6+
7+
import {playwire} from '#ads/vendors/playwire';
8+
9+
init(window);
10+
register('playwire', playwire);
11+
12+
window.draw3p = draw3p;

ads/_config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,6 +1042,14 @@ const adConfig = jsonConfiguration({
10421042
renderStartImplemented: true,
10431043
},
10441044

1045+
'playwire': {
1046+
prefetch: [
1047+
'https://securepubads.g.doubleclick.net/tag/js/gpt.js',
1048+
'https://cdn.intergient.com/amp/amp.js',
1049+
],
1050+
renderStartImplemented: true,
1051+
},
1052+
10451053
'plista': {},
10461054

10471055
'polymorphicads': {

ads/vendors/playwire.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import {loadScript, validateData} from '#3p/3p';
2+
3+
/**
4+
* @param {!Window} global
5+
* @param {!Object} data
6+
*/
7+
export function playwire(global, data) {
8+
/*eslint "local/camelcase": 0*/
9+
global.playwire = {
10+
allowed_data: [
11+
'publisher',
12+
'website',
13+
'slot',
14+
'path',
15+
'slotNumber',
16+
'json',
17+
],
18+
mandatory_data: ['publisher', 'website', 'slot'],
19+
isAmp: true,
20+
data,
21+
};
22+
23+
validateData(
24+
data,
25+
global.playwire.mandatory_data,
26+
global.playwire.allowed_data
27+
);
28+
29+
loadScript(global, `https://cdn.intergient.com/amp/amp.js`);
30+
}

ads/vendors/playwire.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Playwire
2+
3+
## Example
4+
5+
```html
6+
<amp-ad width="320" height="250" id="playwire_ad2" type="playwire" data-publisher="343" data-website="926" data-slot="standard_iab_cntr3" data-path="/testme" layout="fixed" data-slot-number="2">
7+
</amp-ad>
8+
```
9+
10+
## Configuration
11+
Each site must be approved and onboarded with Playwire prior to launch. Please visit [Playwire](https://www.playwire.com) for more information. The values provided to the <amp-ad> tag must match the identifiers assigned within your Playwire implementation. For testing you can use the tag example above.
12+
13+
### Required parameters
14+
15+
- `data-publisher` - The Playwire publisher ID assigned to the property.
16+
- `data-website` - The website ID associated with the property.
17+
- `data-slot` - The Playwire slot identifier corresponding to the ad unit.
18+
19+
### Optional parameters
20+
21+
- `data-json` - JSON object to configure additional settings. Refer to Playwire documentation for supported options.

examples/amp-ad/ads.amp.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@
353353
<option>pixad</option>
354354
<option>pixels</option>
355355
<option>playstream</option>
356+
<option>Playwire</option>
356357
<option>plista</option>
357358
<option>polymorphicads</option>
358359
<option>popin</option>
@@ -1565,6 +1566,10 @@ <h2>PlayStream</h2>
15651566
data-fluid="true" layout="responsive">
15661567
</amp-ad>
15671568

1569+
<h2>Playwire</h2>
1570+
<amp-ad width="320" height="250" id="playwire_ads" type="playwire" data-publisher="343" data-website="926" data-slot="standard_iab_cntr3" data-path="/testme" layout="fixed">
1571+
</amp-ad>
1572+
15681573
<h2>Plista responsive widget</h2>
15691574
<amp-embed width="300" height="300" type="plista" layout=responsive data-countrycode="de"
15701575
data-publickey="e6a75b42216ffc96b7ea7ad0c94d64946aedaac4" data-widgetname="iAMP_2" data-geo="de" data-urlprefix=""

extensions/amp-ad/amp-ad.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ See [amp-ad rules](validator-amp-ad.protoascii) in the AMP validator specificati
430430
- [PIberica](../../ads/vendors/piberica.md)
431431
- [Pixad](../../ads/vendors/pixad.md)
432432
- [Pixels](../../ads/vendors/pixels.md)
433+
- [Playwire](../../ads/vendors/playwire.md)
433434
- [plista](../../ads/vendors/plista.md)
434435
- [polymorphicAds](../../ads/vendors/polymorphicads.md)
435436
- [popin](../../ads/vendors/popin.md)

0 commit comments

Comments
 (0)