Skip to content

Commit

Permalink
Add amp-ad support for myoffrz (#30316)
Browse files Browse the repository at this point in the history
  • Loading branch information
luciancor committed Sep 21, 2020
1 parent 71cd740 commit 07aa36f
Show file tree
Hide file tree
Showing 6 changed files with 107 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 @@ -195,6 +195,7 @@ import {mixpo} from '../ads/mixpo';
import {monetizer101} from '../ads/monetizer101';
import {mox} from '../ads/mox';
import {my6sense} from '../ads/my6sense';
import {myoffrz} from '../ads/myoffrz';
import {mytarget} from '../ads/mytarget';
import {mywidget} from '../ads/mywidget';
import {nativeroll} from '../ads/nativeroll';
Expand Down Expand Up @@ -514,6 +515,7 @@ register('mixpo', mixpo);
register('monetizer101', monetizer101);
register('mox', mox);
register('my6sense', my6sense);
register('myoffrz', myoffrz);
register('mytarget', mytarget);
register('mywidget', mywidget);
register('nativeroll', nativeroll);
Expand Down
4 changes: 4 additions & 0 deletions ads/_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,10 @@ const adConfig = jsonConfiguration({
renderStartImplemented: true,
},

'myoffrz': {
renderStartImplemented: true,
},

'mytarget': {
prefetch: 'https://ad.mail.ru/static/ads-async.js',
renderStartImplemented: true,
Expand Down
34 changes: 34 additions & 0 deletions ads/myoffrz.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* Copyright 2020 The AMP HTML Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS-IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import {validateData, writeScript} from '../3p/3p';

/**
* @param {!Window} global
* @param {!Object} data
*/
export function myoffrz(global, data) {
validateData(data, ['config'], ['script']);
global.config = data.config;
global.sourceUrl = global.context.sourceUrl;

// create an expected placeholder
const d = global.document.createElement('div');
d.setAttribute('id', 'myoffrz');
global.document.getElementById('c').appendChild(d);

writeScript(global, data.script || 'https://cdn.myoffrz.io/amp/script.js');
}
40 changes: 40 additions & 0 deletions ads/myoffrz.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!---
Copyright 2020 The AMP HTML Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS-IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

# myoffrz

## Example

```html
<amp-ad
width="320"
height="50"
type="myoffrz"
data-config='{"channel": "sample", "count": 1}'
layout="responsive"
>
</amp-ad>
```

## Configuration

Supported parameters:

- `data-config`

Optional parameters:

- `data-script`
26 changes: 26 additions & 0 deletions examples/ads.amp.html
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@
<option>monetizer101</option>
<option>mox</option>
<option>my6sense</option>
<option>myoffrz</option>
<option>mytarget</option>
<option>mywidget</option>
<option>nativeroll</option>
Expand Down Expand Up @@ -1632,6 +1633,31 @@ <h2>My6sense</h2>
data-paid-clicks="[PAID_TRACKING_PIXEL]">
</amp-ad>

<h2>MyOffrz</h2>
<amp-ad width="300" height="200"
type="myoffrz"
data-script="https://cdn.myoffrz.io/amp/sample/script.js"
data-config='{"channel": "sample", "count": 0}'>
<div placeholder>Loading ...</div>
<div fallback>No ad for you</div>
</amp-ad>

<amp-ad width="300" height="200"
type="myoffrz"
data-script="https://cdn.myoffrz.io/amp/sample/script.js"
data-config='{"channel": "sample", "count": 1}'>
<div placeholder>Loading ...</div>
<div fallback>No ad for you</div>
</amp-ad>

<amp-ad width="300" height="415"
type="myoffrz"
data-script="https://cdn.myoffrz.io/amp/sample/script.js"
data-config='{"channel": "sample", "count": 2}'>
<div placeholder>Loading ...</div>
<div fallback>No ad for you</div>
</amp-ad>

<h2>myTarget</h2>
<amp-ad width="300" height="250"
type="mytarget"
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 @@ -381,6 +381,7 @@ See [amp-ad rules](validator-amp-ad.protoascii) in the AMP validator specificati
- [Monetizer101](../../ads/monetizer101.md)
- [mox](../../ads/mox.md)
- [my6Sense](../../ads/my6sense.md)
- [MyOffrz](../../ads/myoffrz.md)
- [myTarget](../../ads/mytarget.md)
- [myWidget](../../ads/mywidget.md)
- [NativeRoll](../../ads/nativeroll.md)
Expand Down

0 comments on commit 07aa36f

Please sign in to comment.