Skip to content

Commit

Permalink
Pixad Ad Integration
Browse files Browse the repository at this point in the history
  • Loading branch information
fatihkaya84 committed Jan 15, 2024
1 parent 6164aca commit 5bc7d60
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 0 deletions.
1 change: 1 addition & 0 deletions 3p/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ import {openadstream} from '#ads/vendors/openadstream';
import {openx} from '#ads/vendors/openx';
import {opinary} from '#ads/vendors/opinary';
import {outbrain} from '#ads/vendors/outbrain';
import {pixad} from '#ads/vendors/pixad';
import {pixels} from '#ads/vendors/pixels';
import {playstream} from '#ads/vendors/playstream';
import {plista} from '#ads/vendors/plista';
Expand Down
12 changes: 12 additions & 0 deletions 3p/vendors/pixad.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 {pixad} from '#ads/vendors/pixad';

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

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

'pixad': {},

'pixels': {
prefetch: 'https://cdn.adsfactor.net/amp/pixels-amp.min.js',
clientIdCookieName: '__AF',
Expand Down
38 changes: 38 additions & 0 deletions ads/vendors/pixad.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import {validateData, writeScript} from '#3p/3p';

/**
* @param {!Window} global
* @param {!Object} data
*/
export function pixad(global, data) {
validateData(data, ['adNetwork','adPublisher','adTypeId']);
global._pixad = global._pixad || {
publisher: data['adNetwork'],
adNetwork: data['adPublisher'],
adTypeId: data['adTypeId'],
host: `static.cdn.pixad.com.tr`,
prefix: `px`
};

if(data['adNetwork'].indexOf("adm-pub") != -1) {
global._pixad.host = `static.cdn.admatic.com.tr`;
global._pixad.prefix = `adm`;
};

const ins = global.document.createElement('ins');
ins.setAttribute('data-publisher', global._pixad.publisher);
if(global._pixad.adTypeId == "standard") {
ins.setAttribute('data-ad-size', `[[${data.width},${data.height}]]`);
};
ins.setAttribute('data-ad-network', global._pixad.adNetwork);
ins.setAttribute('data-ad-type-id', global._pixad.adTypeId);
ins.setAttribute('class', `${global._pixad.prefix}-ads-area`);
global.document.getElementById('c').appendChild(ins);
ins.parentNode.addEventListener(
'eventAdbladeRenderStart',
global.context.renderStart()
);

writeScript(global, `https://${global._pixad.host}/showad/showad.min.js`);

}
26 changes: 26 additions & 0 deletions ads/vendors/pixad.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Pixad

## Example of Pixad's model implementation

### Basic

```html
<amp-ad
type="pixad"
width="300"
height="250"
data-ad-type-id="standard"
data-ad-network="px-pub-6514176248"
data-ad-publisher="654b7d501cd4137ca98e020d">
</amp-ad>
```

## Configuration

For details on the configuration semantics, see [Pixad documentation](https://developer.pixad.com.tr/).

### Required parameters

- `data-ad-network`: Network ID
- `data-ad-publisher`: Publisher ID
- `data-ad-type-id`: Model ID
10 changes: 10 additions & 0 deletions examples/amp-ad/ads.amp.esm.html
Original file line number Diff line number Diff line change
Expand Up @@ -1705,6 +1705,16 @@ <h2>Outbrain widget</h2>
data-testMode="true">
</amp-embed>

<h2>Pixad</h2>
<amp-ad
type="pixad"
width="300"
height="250"
data-ad-type-id="standard"
data-ad-network="px-pub-6514176248"
data-ad-publisher="654b7d501cd4137ca98e020d">
</amp-ad>

<h2>Pixels Examples</h2>
<amp-ad width="300" height="250"
type="pixels"
Expand Down
10 changes: 10 additions & 0 deletions examples/amp-ad/ads.amp.html
Original file line number Diff line number Diff line change
Expand Up @@ -1498,6 +1498,16 @@ <h2>Outbrain widget</h2>
data-styleFile="http://localhost/style.css" data-testMode="true">
</amp-embed>

<h2>Pixad</h2>
<amp-ad
type="pixad"
width="300"
height="250"
data-ad-type-id="standard"
data-ad-network="px-pub-6514176248"
data-ad-publisher="654b7d501cd4137ca98e020d">
</amp-ad>

<h2>Pixels Examples</h2>
<amp-ad width="300" height="250" type="pixels" data-origin="af" data-sid="2847717911664" data-tag="sync"
data-click-tracker="false" data-viewability="true">
Expand Down

0 comments on commit 5bc7d60

Please sign in to comment.