diff --git a/ads/vendors/adman.js b/ads/vendors/adman.js index aecdb8258840..7381c211f800 100644 --- a/ads/vendors/adman.js +++ b/ads/vendors/adman.js @@ -5,15 +5,24 @@ import {validateData} from '#3p/3p'; * @param {!Object} data */ export function adman(global, data) { - validateData(data, ['ws', 'host', 's'], []); - + validateData(data, ['ws', 'host'], []); + const {host, s, ws} = data; const script = global.document.createElement('script'); - script.setAttribute('data-ws', data.ws); - script.setAttribute('data-h', data.host); - script.setAttribute('data-s', data.s); - script.setAttribute('data-tech', 'amp'); - script.src = 'https://static.adman.gr/adman.js'; - global.document.body.appendChild(script); + + if (host.match(/grxchange/)) { + script.onload = function () { + window.Adman.adunit({ + id: ws, + h: 'https://' + host, + elementId: 'c', + }); + }; + return; + } + script.setAttribute('data-ws', ws); + script.setAttribute('data-h', host); + script.setAttribute('data-s', s); + script.setAttribute('data-tech', 'amp'); } diff --git a/examples/adman.amp.html b/examples/adman.amp.html new file mode 100644 index 000000000000..75507de9fa92 --- /dev/null +++ b/examples/adman.amp.html @@ -0,0 +1,107 @@ + + +
+ +Some text
+