Skip to content

Commit

Permalink
appnexus bid adapter - fix outstream render issue with smart ad server (
Browse files Browse the repository at this point in the history
  • Loading branch information
Fawke authored Jan 26, 2021
1 parent 86bdc03 commit ce829e8
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion modules/appnexusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -999,9 +999,22 @@ function hidedfpContainer(elementId) {
}
}

function hideSASIframe(elementId) {
try {
// find script tag with id 'sas_script'. This ensures it only works if you're using Smart Ad Server.
const el = document.getElementById(elementId).querySelectorAll("script[id^='sas_script']");
if (el[0].nextSibling && el[0].nextSibling.localName === 'iframe') {
el[0].nextSibling.style.setProperty('display', 'none');
}
} catch (e) {
// element not found!
}
}

function outstreamRender(bid) {
// push to render queue because ANOutstreamVideo may not be loaded yet
hidedfpContainer(bid.adUnitCode);
hideSASIframe(bid.adUnitCode);
// push to render queue because ANOutstreamVideo may not be loaded yet
bid.renderer.push(() => {
window.ANOutstreamVideo.renderAd({
tagId: bid.adResponse.tag_id,
Expand Down

0 comments on commit ce829e8

Please sign in to comment.