Skip to content

Commit

Permalink
✨Prensa Ibérica amp-ad support (#40138)
Browse files Browse the repository at this point in the history
* Prensa Ibérica amp ads support

* remove changes from 3p/integration.js

* remove changes from 3p/integration.js

---------

Co-authored-by: Sergio Bonet <sbonet@pi360.es>
  • Loading branch information
sbonetclement and sbonetpi360 authored Sep 6, 2024
1 parent d399642 commit 2446633
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 0 deletions.
12 changes: 12 additions & 0 deletions 3p/vendors/piberica.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 {piberica} from '#ads/vendors/piberica';

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

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

'piberica': {
preconnect: ['https://trafico.prensaiberica.es'],
renderStartImplemented: true,
},

'pixad': {},

'pixels': {
Expand Down
6 changes: 6 additions & 0 deletions ads/ads.extern.js
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,12 @@ data.dfpSlot;
data.nc;
data.auid;

// piberica.js
data.height;
data.publisher;
data.slot;
data.width;

// pixels.js
var pixelsAd;
var pixelsAMPAd;
Expand Down
25 changes: 25 additions & 0 deletions ads/vendors/piberica.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import {loadScript, validateData} from '#3p/3p';

/**
* @param {!Window} global
* @param {!Object} data
*/
export function piberica(global, data) {
/*eslint "local/camelcase": 0*/
global._piberica_amp = {
allowed_data: ['publisher', 'slot'],
mandatory_data: ['publisher', 'slot'],
data,
};

validateData(
data,
global._piberica_amp.mandatory_data,
global._piberica_amp.allowed_data
);

loadScript(
global,
`https://trafico.prensaiberica.es/adm/min/intext/${data.publisher}/${data.slot}.js`
);
}
24 changes: 24 additions & 0 deletions ads/vendors/piberica.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# PIberica

## Example

```html
<amp-ad
width="300"
height="1"
type="piberica"
layout="responsive"
data-publisher="test"
data-slot="1"
data-block-on-consent="_till_responded"
></amp-ad>
```

## Configuration

For further information, please contact [PIberica](https://www.prensaiberica360.es).

### Required parameters

- `data-publisher`: Publisher Integration ID provided by PIberica
- `data-slot`: Slot Integration ID provided by PIberica
9 changes: 9 additions & 0 deletions examples/amp-ad/ads.amp.esm.html
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@
<option>openx</option>
<option>opinary</option>
<option>outbrain</option>
<option>piberica</option>
<option>pixad</option>
<option>pixels</option>
<option>plista</option>
Expand Down Expand Up @@ -1716,6 +1717,14 @@ <h2>Outbrain widget</h2>
data-testMode="true">
</amp-embed>

<h2>PIberica</h2>
<amp-ad width="300" height="1"
type="piberica"
layout="responsive"
data-publisher="test"
data-slot="1">
</amp-ad>

<h2>Pixad</h2>
<amp-ad
type="pixad"
Expand Down
9 changes: 9 additions & 0 deletions examples/amp-ad/ads.amp.html
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@
<option>openx</option>
<option>opinary</option>
<option>outbrain</option>
<option>piberica</option>
<option>pixad</option>
<option>pixels</option>
<option>playstream</option>
Expand Down Expand Up @@ -1521,6 +1522,14 @@ <h2>Outbrain widget</h2>
data-styleFile="http://localhost/style.css" data-testMode="true">
</amp-embed>

<h2>PIberica</h2>
<amp-ad width="300" height="1"
type="piberica"
layout="responsive"
data-publisher="test"
data-slot="1">
</amp-ad>

<h2>Pixad</h2>
<amp-ad
type="pixad"
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 @@ -424,6 +424,7 @@ See [amp-ad rules](validator-amp-ad.protoascii) in the AMP validator specificati
- [Open AdStream (OAS)](../../ads/vendors/openadstream.md)
- [OpenX](../../ads/vendors/openx.md)
- [opinary](../../ads/vendors/opinary.md)
- [PIberica](../../ads/vendors/piberica.md)
- [Pixad](../../ads/vendors/pixad.md)
- [Pixels](../../ads/vendors/pixels.md)
- [plista](../../ads/vendors/plista.md)
Expand Down

0 comments on commit 2446633

Please sign in to comment.