Skip to content

Commit

Permalink
New vendor AppMonsta (#40108)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaksymTeqBlaze authored Aug 13, 2024
1 parent 6a0e10e commit a8932a8
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 0 deletions.
2 changes: 2 additions & 0 deletions 3p/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ import {aja} from '#ads/vendors/aja';
import {amoad} from '#ads/vendors/amoad';
import {aniview} from '#ads/vendors/aniview';
import {anyclip} from '#ads/vendors/anyclip';
import {appmonsta} from '#ads/vendors/appmonsta';
import {appnexus} from '#ads/vendors/appnexus';
import {appvador} from '#ads/vendors/appvador';
import {atomx} from '#ads/vendors/atomx';
Expand Down Expand Up @@ -367,6 +368,7 @@ register('aja', aja);
register('amoad', amoad);
register('aniview', aniview);
register('anyclip', anyclip);
register('appmonsta', appmonsta);
register('appnexus', appnexus);
register('appvador', appvador);
register('atomx', atomx);
Expand Down
12 changes: 12 additions & 0 deletions 3p/vendors/appmonsta.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 {appmonsta} from '#ads/vendors/appmonsta';

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

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

'appmonsta': {
preconnect: 'https://ssp.appmonsta.ai',
},

'appnexus': {
prefetch: 'https://acdn.adnxs.com/ast/ast.js',
preconnect: 'https://ib.adnxs.com',
Expand Down
30 changes: 30 additions & 0 deletions ads/vendors/appmonsta.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import {validateData, writeScript} from '#3p/3p';

/**
* @param {!Window} global
* @param {!Object} data
*/
export function appmonsta(global, data) {
validateData(data, ['placementId']);

const {location} = global.context;
let url = 'https://ssp.appmonsta.ai?c=b&m=amp';

const params = [
['placementId', encodeURIComponent(data.placementId)],
['ua', encodeURIComponent(global.navigator?.userAgent)],
['w', data.width],
['h', data.height],
['domain', location.host],
['page', location.pathname],
['secure', location.protocol === 'https:' ? 1 : 0],
['language', global.navigator?.language],
];

for (let i = 0; i < params.length; i++) {
const param = params[i];
url = `${url}&${param[0]}=${param[1] ?? ''}`;
}

writeScript(global, url);
}
17 changes: 17 additions & 0 deletions ads/vendors/appmonsta.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# AppMonsta

## Basic example

```html
<amp-ad
width="300"
height="250"
type="appmonsta"
data-placement-id="test"
>
</amp-ad>
```

### Required parameters

- `placement-id`: Placement 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 @@ -116,6 +116,7 @@
<option>aja</option>
<option>amoad</option>
<option>aniview</option>
<option>appmonsta</option>
<option>appnexus</option>
<option>appvador</option>
<option>atomx</option>
Expand Down Expand Up @@ -833,6 +834,15 @@ <h2>Aniview</h2>
data-channelId="5a5f17a728a06102d14c2718">
</amp-ad>

<h2>AppMonsta</h2>
<amp-ad
width="300"
height="250"
type="appmonsta"
data-placement-id="test"
>
</amp-ad>

<h2>AppNexus with JSON based configuration multi ad</h2>
<amp-ad width="728" height="90" type="appnexus" data-target="apn_ad_2"
json='{"pageOpts":{"member": 958}, "adUnits": [{"disablePsa": true, "tagId": 6063968,"sizes": [300,250],"targetId": "apn_ad_1"}, {"tagId": 6063968,"sizes": [728,90],"targetId":"apn_ad_2"}]}'>
Expand Down
5 changes: 5 additions & 0 deletions examples/amp-ad/ads.amp.html
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@
<option>andbeyond</option>
<option>aniview</option>
<option>anyclip</option>
<option>appmonsta</option>
<option>appnexus</option>
<option>appvador</option>
<option>atomx</option>
Expand Down Expand Up @@ -812,6 +813,10 @@ <h2>AnyClip</h2>
data-widgetname="amp_test_autoplay" data-ac-embed-mode="plain" data-ourl="https://anyclip.com/">
</amp-ad>

<h2>AppMonsta</h2>
<amp-ad width="300" height="250" type="appmonsta" data-placement-id="test">
</amp-ad>

<h2>AppNexus with JSON based configuration multi ad</h2>
<amp-ad width="728" height="90" type="appnexus" data-target="apn_ad_2"
json='{"pageOpts":{"member": 958}, "adUnits": [{"disablePsa": true, "tagId": 6063968,"sizes": [300,250],"targetId": "apn_ad_1"}, {"tagId": 6063968,"sizes": [728,90],"targetId":"apn_ad_2"}]}'>
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 @@ -307,6 +307,7 @@ See [amp-ad rules](validator-amp-ad.protoascii) in the AMP validator specificati
- [Andbeyond](../../ads/vendors/andbeyond.md)
- [Aniview](../../ads/vendors/aniview.md)
- [AnyClip](../../ads/vendors/anyclip.md)
- [AppMonsta](../../ads/vendors/appmonsta.md)
- [AppNexus](../../ads/vendors/appnexus.md)
- [AppVador](../../ads/vendors/appvador.md)
- [Atomx](../../ads/vendors/atomx.md)
Expand Down

0 comments on commit a8932a8

Please sign in to comment.