-
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.
- Loading branch information
1 parent
6a0e10e
commit a8932a8
Showing
8 changed files
with
81 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 {appmonsta} from '#ads/vendors/appmonsta'; | ||
|
||
init(window); | ||
register('appmonsta', appmonsta); | ||
|
||
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,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); | ||
} |
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,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 |
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