forked from ampproject/amphtml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6164aca
commit 5bc7d60
Showing
7 changed files
with
99 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,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`); | ||
|
||
} |
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,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 |
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