-
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.
✨ AdMatic Ad Integration | New (#39771)
* Pixad Ad Integration * updated trailing whitespace. * fix * Update pixad.js * Update integration.js * Update amp-ad.md * Update pixad.md * AdMatic Ad Integration | New add support to amp-ad for the AdMatic type. * update * Update admatic.md
- Loading branch information
1 parent
69f9574
commit 36fa762
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 {admatic} from '#ads/vendors/admatic'; | ||
|
||
init(window); | ||
register('admatic', admatic); | ||
|
||
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 admatic(global, data) { | ||
validateData(data, ['adNetwork', 'adPublisher', 'adTypeId']); | ||
global._admatic = global._admatic || { | ||
publisher: data['adNetwork'], | ||
adNetwork: data['adPublisher'], | ||
adTypeId: data['adTypeId'], | ||
host: `static.cdn.pixad.com.tr`, | ||
prefix: `px`, | ||
}; | ||
|
||
if (global._admatic.publisher.indexOf('adm-pub') != -1) { | ||
global._admatic.host = `static.cdn.admatic.com.tr`; | ||
global._admatic.prefix = `adm`; | ||
} | ||
|
||
const ins = global.document.createElement('ins'); | ||
ins.setAttribute('data-publisher', global._admatic.publisher); | ||
if (global._admatic.adTypeId == 'standard') { | ||
ins.setAttribute('data-ad-size', `[[${data.width},${data.height}]]`); | ||
} | ||
ins.setAttribute('data-ad-network', global._admatic.adNetwork); | ||
ins.setAttribute('data-ad-type-id', global._admatic.adTypeId); | ||
ins.setAttribute('class', `${global._admatic.prefix}-ads-area`); | ||
global.document.getElementById('c').appendChild(ins); | ||
ins.parentNode.addEventListener( | ||
'eventAdbladeRenderStart', | ||
global.context.renderStart() | ||
); | ||
|
||
writeScript(global, `https://${global._admatic.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 @@ | ||
# AdMatic | ||
|
||
## Example of AdMatic's model implementation | ||
|
||
### Basic | ||
|
||
```html | ||
<amp-ad | ||
type="admatic" | ||
width="300" | ||
height="250" | ||
data-ad-type-id="standard" | ||
data-ad-network="adm-pub-194162670389" | ||
data-ad-publisher="65943e194d11b285b6173588"> | ||
</amp-ad> | ||
``` | ||
|
||
### Sticky Ad | ||
|
||
```html | ||
<amp-sticky-ad layout="nodisplay"> | ||
<amp-ad | ||
type="admatic" | ||
width="320" | ||
height="100" | ||
data-ad-type-id="standard" | ||
data-ad-network="adm-pub-194162670389" | ||
data-ad-publisher="65943e194d11b285b6173588"> | ||
</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 [AdMatic documentation](https://www.admatic.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