diff --git a/3p/integration.js b/3p/integration.js index d89a0bc89f8e..4f27e295985e 100644 --- a/3p/integration.js +++ b/3p/integration.js @@ -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'; @@ -353,6 +354,7 @@ const AMP_EMBED_ALLOWED = { svknative: true, taboola: true, temedya: true, + vlyby: true, whopainfeed: true, yahoofedads: true, yahoonativeads: true, @@ -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); diff --git a/ads/_config.js b/ads/_config.js index 0485bb591651..4a1f7e06462a 100755 --- a/ads/_config.js +++ b/ads/_config.js @@ -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'], diff --git a/ads/vlyby.js b/ads/vlyby.js new file mode 100644 index 000000000000..064884ef7d0b --- /dev/null +++ b/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); + } +} diff --git a/ads/vlyby.md b/ads/vlyby.md new file mode 100644 index 000000000000..fac8e0376ea3 --- /dev/null +++ b/ads/vlyby.md @@ -0,0 +1,43 @@ + + +# vlyby + +## Example + +```html + + +``` + +## 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) diff --git a/examples/ads.amp.html b/examples/ads.amp.html index 85f2f5c27750..e54efdf9b101 100644 --- a/examples/ads.amp.html +++ b/examples/ads.amp.html @@ -286,6 +286,7 @@ + @@ -2578,6 +2579,16 @@

Viralize

data-extra='{"lid":"22486","cid":"22572","preview":"1","f":"gallery"}'> +

vlyby

+ + +

VMFive