-
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.
✨ Pixad Ad Integration | New (#39744)
* Pixad Ad Integration * updated trailing whitespace. * fix * Update pixad.js * Update integration.js * Update amp-ad.md * Update pixad.md
- Loading branch information
1 parent
0e60e0c
commit ef8eac7
Showing
8 changed files
with
127 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 {pixad} from '#ads/vendors/pixad'; | ||
|
||
init(window); | ||
register('pixad', pixad); | ||
|
||
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,37 @@ | ||
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 (global._pixad.publisher.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`); | ||
} |
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,51 @@ | ||
# 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> | ||
``` | ||
|
||
### Sticky Ad | ||
|
||
```html | ||
<amp-sticky-ad layout="nodisplay"> | ||
<amp-ad | ||
type="pixad" | ||
width="320" | ||
height="100" | ||
data-ad-type-id="778130932" | ||
data-ad-network="px-pub-6514176248" | ||
data-ad-publisher="654b7d501cd4137ca98e020d"> | ||
</amp-ad> | ||
</amp-sticky-ad> | ||
``` | ||
|
||
Note that `<amp-sticky-ad />` component requires the following script to be included in the page: | ||
|
||
```html | ||
<script | ||
async | ||
custom-element="amp-sticky-ad" | ||
src="https://cdn.ampproject.org/v0/amp-sticky-ad-1.0.js" | ||
></script> | ||
``` | ||
|
||
## 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 |
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
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