Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Added new ad network vlyby #30205

Merged
merged 22 commits into from
Sep 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions 3p/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ import {vdoai} from '../ads/vdoai';
import {videointelligence} from '../ads/videointelligence';
import {videonow} from '../ads/videonow';
import {viralize} from '../ads/viralize';
import {vlyby} from '../ads/vlyby';
import {vmfive} from '../ads/vmfive';
import {webediads} from '../ads/webediads';
import {weboramaDisplay} from '../ads/weborama';
Expand Down Expand Up @@ -339,6 +340,7 @@ const AMP_EMBED_ALLOWED = {
svknative: true,
taboola: true,
temedya: true,
vlyby: true,
whopainfeed: true,
yahoofedads: true,
yahoonativeads: true,
Expand Down Expand Up @@ -580,6 +582,7 @@ register('videointelligence', videointelligence);
register('videonow', videonow);
register('viqeoplayer', viqeoplayer);
register('viralize', viralize);
register('vlyby', vlyby);
register('vmfive', vmfive);
register('webediads', webediads);
register('weborama-display', weboramaDisplay);
Expand Down
4 changes: 4 additions & 0 deletions ads/_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -1154,6 +1154,10 @@ const adConfig = jsonConfiguration({
renderStartImplemented: true,
},

'vlyby': {
prefetch: 'https://amp.vlyby.com/qad/qad-outer2.js',
},

'vmfive': {
prefetch: 'https://man.vm5apis.com/dist/adn-web-sdk.js',
preconnect: ['https://vawpro.vm5apis.com', 'https://vahfront.vm5apis.com'],
Expand Down
74 changes: 74 additions & 0 deletions ads/vlyby.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/**
* Copyright 2016 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.
*/
/* eslint-disable require-jsdoc */
import {validateData} from '../3p/3p';

/**
* @param {!Window} global
* @param {!Object} data
*/
export function vlyby(global, data) {
/*eslint "google-camelcase/google-camelcase": 0*/
global._vlyby_amp = {
allowed_data: ['publisherid', 'placementid', 'pubref'],
mandatory_data: ['publisherid', 'placementid'],
data: {
pubref: '',
publisherid: '',
placementid: '',
...data,
},
};

validateData(data, global._vlyby_amp.mandatory_data);

const rand = Math.round(Math.random() * 100000000);

// install observation on entering/leaving the view
global.context.observeIntersection(function (changes) {
/** @type {!Array} */ (changes).forEach(function (c) {
if (global._vlyby_amp) {
global._vlyby_amp.rects = c;
}
});
});

//create Container
const containerId = 'qad' + rand;
createContainer(global, containerId);

//create Script
createScript(global, containerId);

function createScript(global, id) {
const s = global.document.createElement('script');
const referrer = data['pubref'] || global.context.canonicalUrl;

s.setAttribute('type', 'text/javascript');
s.setAttribute('async', 'true');
s.setAttribute('src', '//amp.vlyby.com/qad/qad-outer2.js');
s.setAttribute('data-PubId', data['publisherid']);
s.setAttribute('data-PlacementId', data['placementid']);
s.setAttribute('data-DivId', id);
s.setAttribute('data-PubRef', referrer);
global.document.getElementById('c').appendChild(s);
}
function createContainer(global, id) {
const d = global.document.createElement('div');
d.id = id;
global.document.getElementById('c').appendChild(d);
}
}
43 changes: 43 additions & 0 deletions ads/vlyby.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!---
Copyright 2016 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.
-->

# vlyby

## Example

```html
<amp-embed
width="300"
height="250"
type="vlyby"
layout="responsive"
heights="250px"
data-publisherid="f363eb2b75459b34592cc4"
data-placementid="default"
data-pubref="test.amp.com"
>
</amp-embed>
```

## Configuration

Supported parameters:

All parameters are mandatory, only `data-pubref` is optional.

- `data-publisherid` (String, non-empty)
- `data-placementid` (String, non-empty)
- `data-pubref` (String)
11 changes: 11 additions & 0 deletions examples/ads.amp.html
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@
<option>videointelligence</option>
<option>videonow</option>
<option>viralize</option>
<option>vlyby</option>
<option>vmfive</option>
<option>webediads</option>
<option>weborama</option>
Expand Down Expand Up @@ -2448,6 +2449,16 @@ <h2>Viralize</h2>
data-extra='{"lid":"22486","cid":"22572","preview":"1","f":"gallery"}'>
</amp-ad>

<h2>vlyby</h2>
<amp-embed width="300" height="250"
type="vlyby"
layout="responsive"
heights="250px"
data-publisherid="f363eb2b75459b34592cc4"
data-placementid="default"
data-pubref="test.amp.com">
</amp-embed>

<h2>VMFive</h2>
<amp-ad width="300" height="169"
type="vmfive"
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 @@ -457,6 +457,7 @@ See [amp-ad rules](https://github.com/ampproject/amphtml/blob/master/extensions/
- [Strossle](../../ads/strossle.md)
- [Taboola](../../ads/taboola.md)
- [TE Medya](../../ads/temedya.md)
- [vlyby](../../ads/vlyby.md)
- [Whopa InFeed](../../ads/whopainfeed.md)
- [Yahoo Native-Display Ads Federation](../../ads/yahoofedads.md)
- [Yahoo Native Ads](../../ads/yahoonativeads.md)
Expand Down