window.ayManagerEnv.versionInfo.addToHashKey = true; googletag.cmd.push(function() { var safeframe = window.YM_SPLIT_TESTS && window.YM_SPLIT_TESTS.safeframe && window.YM_SPLIT_TESTS.safeframe.value; googletag.pubads().setTargeting('ay_hb_safeframe', safeframe !== 'off' ? '1' : '0'); googletag.pubads().setTargeting('ay_hb_house', '1'); }); pbjs.que.push(function() { pbjs.onEvent('setTargeting', function(adUnitTargeting) { Object.keys(adUnitTargeting).forEach(function(adUnitCode) { var targeting = adUnitTargeting[adUnitCode]; if (targeting.hb_bidder === 'ogury') { var slot = googletag.pubads().getSlots().find(function(slot) { return slot.getSlotElementId() === adUnitCode; }); if (slot) { slot.setTargeting('ay_hb_safeframe', '0'); } } }); }); }); googletag.cmd.push(function() { googletag.pubads().addEventListener('slotRequested', function(event) { if (event.slot.getTargetingKeys()['ay_hb_safefame']) { event.slot.clearTargeting('ay_hb_safefame'); } }); }); (function() { var wasNsfw = window.isNsfw; var destroyAll = function() { ayManagerEnv.destroy(ayManagerEnv.settings.adUnitInstances.map(function(unit) { return unit.code; }), { useInstanceCodes: true }); }; ayManagerEnv.onEvent('beforePageChange', function() { if (!wasNsfw && window.isNsfw) { destroyAll(); // ayManagerEnv.settings.yieldScriptSettings.yieldScriptMode = false; } else if (wasNsfw && !window.isNsfw) { // ayManagerEnv.settings.yieldScriptSettings.yieldScriptMode = 'BOTH'; } wasNsfw = window.isNsfw; }); /* var isSelf = false; ayManagerEnv.onEvent('afterPageChange', function() { if (isSelf) { isSelf = false; return; } isSelf = true; setTimeout(function() { ayManagerEnv.changePage(); }, 1500); }); */ var adIndexes = {}; ayManagerEnv.onEvent("afterDefineSlot", function(adUnitInstanceCode, slot) { var adUnitCode = adUnitInstanceCode.replace(/__ayManagerEnv__.+$/, ''); if (!adIndexes[adUnitCode]) { adIndexes[adUnitCode] = 0; } var targetingMap = { ad_index: ++adIndexes[adUnitCode], }; slot.updateTargetingFromMap(targetingMap); }); function updateTargeting() { googletag.cmd.push(function() { googletag.pubads().setTargeting('bucket', (window._config && _config.config.appVersion) || '00341'); googletag.pubads().setTargeting('utm_campaign', 'null'); googletag.pubads().setTargeting('screen', 'home'); try { googletag.pubads().setTargeting('section', location.pathname.split('/')[2]); } catch (e) {} }); } updateTargeting(); var originalReplaceState = window.history.replaceState; window.history.replaceState = function() { for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++) t[n] = arguments[n]; originalReplaceState.apply(window.history, t); try { updateTargeting(); } catch (e) { console.error(e); } }; window.addEventListener('popstate', function(event) { if (event.state) { updateTargeting(); } }); })(); pbjs.bidderSettings = { standard: { storageAllowed: true, adserverTargeting: [ { key: "hb_bidder", val: function(bidResponse) { return bidResponse.bidderCode; } }, { key: "hb_adid", val: function(bidResponse) { return bidResponse.adId; } }, { key: "ay_hb_pb", val: function(bidResponse) { return bidResponse.pbHg; } }, { key: 'hb_size', val: function (bidResponse) { return bidResponse.size; } }, { key: 'hb_source', val: function (bidResponse) { return bidResponse.source; } }, { key: 'hb_format', val: function (bidResponse) { return bidResponse.mediaType; } } ] } } // aps outstream viewable issue workaround window.addEventListener('assertive_logImpression', function(event) { var payload = event.data.payload; var map = payload.dfpTargetingMap; if (payload.apsWon) { if (payload.slotId.includes('sidebar_1') || payload.slotId.includes('sidebar_2')) { if (map.amznbid && map.amznbid.length && map.amznbid[0].startsWith('o_')) { setTimeout(function() { ayManagerEnv.refresh([payload.slotId], { useInstanceCodes: true }); }, 29000); } } } });