Skip to content

Commit

Permalink
✨ Added new ad network vlyby (#30205)
Browse files Browse the repository at this point in the history
* initial setup

* added correct cdn links and added prop for observer

* updated readme

* added missing comma

* removed unused code and fixed linter errors

* fixed vlyby readme linter issues

* initial setup email added rebase

* added correct cdn links and added prop for observer

* updated readme

* added missing comma

* removed unused code and fixed linter errors

* fixed vlyby readme linter issues

* added allowed_data

* fixed prettier error

* fixed types

* type check err fix

* fixed getdata

* removed unnecessary global pass down

* pass down global fix

* fixed missing param

* reverted last 2 commits

Co-authored-by: Martin Schwager <mschwager@notebooksbilliger.de>
Co-authored-by: Martin <martin@samcube.de>
  • Loading branch information
3 people committed Sep 14, 2020
1 parent 23a38c4 commit 80f913d
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 0 deletions.
3 changes: 3 additions & 0 deletions 3p/integration.js
Expand Up @@ -284,6 +284,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 @@ -353,6 +354,7 @@ const AMP_EMBED_ALLOWED = {
svknative: true,
taboola: true,
temedya: true,
vlyby: true,
whopainfeed: true,
yahoofedads: true,
yahoonativeads: true,
Expand Down Expand Up @@ -604,6 +606,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
Expand Up @@ -1201,6 +1201,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
@@ -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
@@ -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
Expand Up @@ -286,6 +286,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 @@ -2578,6 +2579,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
Expand Up @@ -498,6 +498,7 @@ See [amp-ad rules](validator-amp-ad.protoascii) in the AMP validator specificati
- [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

0 comments on commit 80f913d

Please sign in to comment.