Hemos actualizado nuestra Política de Privacidad recientemente. Al seguir utilizando Va a gustarme, estás aceptando los cambios.
\n' +
'',
nativeContainer: '',
}
})
}
}
if (adUnit['indexExchange']) {
let bid = {
bidder: 'ix',
params: adUnit['indexExchange'],
}
sizes.forEach(function (size) {
let b = JSON.parse(JSON.stringify(bid))
b.params.size = size
bids.push(b)
})
}
if (adUnit['districtm']) {
bids.push({
bidder: 'districtm',
params: {
placementId: adUnit['districtm'],
video: {
skippable: true,
playback_method: ['auto_play_sound_off']
}
}
})
}
if (adUnit['districtmDMX']) {
bids.push({
bidder: 'districtmDMX',
params: {
dmxid: adUnit['districtmDMX'],
memberid: '100715',
}
})
}
if (adUnit['openx']) {
bids.push({
bidder: 'openx',
params: {
delDomain: 'vonvon-kst-usd-d.openx.net',
unit: adUnit['openx'],
}
})
}
if (adUnit['appnexus']) {
bids.push({
bidder: 'appnexus',
params: {
placementId: adUnit['appnexus'],
video: {
skippable: true,
playback_method: ['auto_play_sound_off']
}
}
})
}
if (adUnit['sortable']) {
bids.push({
bidder: 'sortable',
params: {
tagId: adUnit['adUnitPath']
}
})
}
if (adUnit['emxdigital']) {
bids.push({
bidder: 'emxdigital',
params: {
placementId: adUnit['emxdigital']
}
})
}
if (adUnit['aol']) {
bids.push({
bidder: 'aol',
params: {
network: '10881.1',
placement: adUnit['aol']
}
})
}
if (adUnit['triplelift'] && window.vvIsMobile()) {
bids.push({
bidder: 'triplelift',
params: {
inventoryCode: adUnit['triplelift']
}
})
}
if (adUnit['conversant']) {
bids.push({
bidder: 'conversant',
params: {
site_id: adUnit['conversant'],
//tag_id: adUnit['adUnitPath'],
secure: location.protocol == 'https:' ? 1 : 0,
}
})
}
if (adUnit['rubicon']) {
bids.push({
bidder: 'rubicon',
params: {
accountId: '20662',
siteId: '256438',
zoneId: adUnit['rubicon'],
}
})
}
if (adUnit['sovrn']) {
bids.push({
bidder: 'sovrn',
params: {
tagid: adUnit['sovrn']
}
})
}
ret['bids'] = bids
return ret
};
var advelvetTargeting = [];
advelvetTargeting.push((Math.floor(Math.random() * 20) + 1) + "");
googletag.cmd.push(function () {
if (window.grt_origin) {
googletag.pubads().setTargeting('grt_origin', window.grt_origin);
}
googletag.pubads().collapseEmptyDivs();
googletag.pubads().enableAsyncRendering();
googletag.pubads().disableInitialLoad();
googletag.pubads().setTargeting('advelvet', advelvetTargeting);
googletag.pubads().setTargeting('article_domain', window.location.hostname);
googletag.enableServices();
pbjs.que.push(function () {
pbjs.aliasBidder('ix', 'indexExchange');
pbjs.enableAnalytics({
provider: 'ga',
options: {
trackerName: 'prebidTracker',
enableDistribution: false,
sampling: 0.001,
}
});
// pbjs.setConfig({ enableSendAllBids: false })
if (window.location.hostname.indexOf(".smalljoys.tv") > -1) {
pbjs.setConfig({
sortable: {
siteId: 'smalljoys.tv'
},
userSync: {
filterSettings: {
iframe: {
bidders: ['openx', 'sortable', 'districtm', 'districtmDMX'],
filter: 'include'
}
},
syncsPerBidder: 0
}
})
}
pbjs.bidderSettings = {
standard: {
adserverTargeting: [
{
key: "fb_bidid",
val: function (bidResponse) {
// make the bidId available for targeting if required
return bidResponse.fb_bidid;
}
},
{
key: "hb_bidder",
val: function (bidResponse) {
return bidResponse.bidderCode;
}
},
{
key: "hb_pb",
val: function (bidResponse) {
var cpm = bidResponse.cpm * window._vv_krw_per_usd;
if (cpm < 2000) {
return (Math.floor(cpm / 50) * 50).toFixed(0);
} else if (cpm < 5000) {
return (Math.floor(cpm / 100) * 100).toFixed(0);
} else if (cpm < 10000) {
return (Math.floor(cpm / 500) * 500).toFixed(0);
} else if (cpm < 20000) {
return (Math.floor(cpm / 1000) * 1000).toFixed(0);
} else {
return '20000';
}
}
},
{
key: 'hb_adid',
val: function (bidResponse) {
return bidResponse.adId;
}
},
],
},
};
var __adUnits = []
.concat(window._vv_adUnits.map(function(adUnit) { return window.genAdUnit(adUnit, [[336, 280], [300, 250]])}))
.concat(window._vv_header_slot.map(function(adUnit) { return window.genAdUnit(adUnit, [[320, 100], [320, 50]])}))
.concat(window._vv_middle_of_list.map(function(adUnit) { return window.genAdUnit(adUnit, [[336, 280], [300, 250]])}))
pbjs.addAdUnits(__adUnits);
if (window.vvIsMobile() && window._vv_anchor_FAN) {
var _unit = window.genAdUnit({
adUnitPath: '/34009881/Articles_anchor', divId: 'articles_anchor',
FAN: window._vv_anchor_FAN, FAN_format: '320x50',
conversant: window._vv_anchor_conversant, sovrn: window._vv_anchor_sovrn,
// appnexus: '15127960', openx: '540664080', indexExchange: {siteId: '353905'},
}, [[320, 50]])
pbjs.addAdUnits([_unit]);
var last_showtime = 0;
function _showAnchor() {
if (!jQuery('#articles_anchor_wrapper')) {
return setTimeout(_showAnchor, 100)
}
last_showtime = (new Date()).getTime()
jQuery('#articles_anchor_wrapper').css({visibility: 'visible'})
}
googletag.cmd.push(function () {
const slot = googletag.defineSlot('/34009881/Articles_anchor', [[320, 50]], 'articles_anchor')
.addService(googletag.pubads()).setCollapseEmptyDiv(true);
googletag.display('articles_anchor');
var scr_timer = null;
var is_loading = false;
var last_bidtime = 0;
var _fn = function () {
if (window.NO_SHOW_AD) {
return
}
scr_timer = null
if (is_loading) {
console.log(pretext, 'already loading')
return;
}
if (jQuery('#articles_anchor_wrapper') && jQuery('#articles_anchor_wrapper').css('visibility') == 'visible') {
return;
}
is_loading = true;
pbjs.que.push(function () {
pbjs.removeAdUnit('articles_anchor');
pbjs.addAdUnits([_unit]);
console.log(pretext, 'request anchor')
var cnt = 0;
var _to = setTimeout(function () {
_done(true)
}, hb_timeout + 100);
var _done = function (force) {
cnt++;
if ((cnt < 2 && !force) || cnt > 3 || !_to) {
return
}
clearTimeout(_to)
_showAnchor()
googletag.cmd.push(function () {
googletag.pubads().refresh([slot])
is_loading = false;
});
}
last_bidtime = (new Date()).getTime();
apstag.fetchBids({
timeout: hb_timeout,
slots: [{
slotID: 'articles_anchor',
slotName: '/34009881/Articles_anchor',
sizes: [[320, 50]]
}],
}, function (bids) {
apstag.setDisplayBids()
_done()
});
pbjs.requestBids({
timeout: hb_timeout,
adUnitCodes: ['articles_anchor'],
bidsBackHandler: function () {
pbjs.que.push(function () {
googletag.cmd.push(function () {
pbjs.setTargetingForGPTAsync(['articles_anchor']);
_done();
})
})
}
})
})
};
window.addEventListener('scroll', function () {
if (scr_timer) {
clearTimeout(scr_timer)
}
if (jQuery && (new Date()).getTime() - last_showtime > 3500) {
jQuery('#articles_anchor_wrapper').css({visibility: 'hidden'})
}
scr_timer = setTimeout(_fn, 1000)
});
setTimeout(_fn, 0);
});
}
})
});
window.firstFourAdsCpm = 0
window.firstFourAdsCpmCnt = 0
window.slotInfos = window.slotInfos || [];
function isElementInViewport(el) {
//special bonus for those using jQuery
if (typeof jQuery === "function" && el instanceof jQuery) {
el = el[0];
}
if (!el) return false;
var rect = el.getBoundingClientRect();
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && /*or $(window).height() */
rect.right <= (window.innerWidth || document.documentElement.clientWidth) /*or $(window).width() */
);
}
window._requestBids = function (slot, div_id, slotName) {
if (window.NO_SHOW_AD) {
return
}
function checkVisible() {
if (jQuery('#' + div_id) && jQuery('#' + div_id).offset() && jQuery('#' + div_id).offset().top < (window.scrollY + window.innerHeight * 3)) {
pbjs.que.push(function () {
console.log(pretext, "requestBids", div_id);
var cnt = 0;
var _done = function (force) {
cnt++;
if ((cnt < 2 && !force) || cnt > 3 || !_to) {
return
}
clearTimeout(_to)
googletag.cmd.push(function () {
console.log(pretext, "refreshSlot", div_id);
googletag.pubads().refresh([slot]);
slotInfo.is_refreshing = false;
slotInfo.refreshed_at = (new Date().getTime());
})
}
apstag.fetchBids({
timeout: hb_timeout,
slots: [{
slotName,
slotID: div_id,
sizes: [[336, 280], [300, 250]]
}],
}, function (bids) {
apstag.setDisplayBids()
_done()
});
pbjs.requestBids({
timeout: hb_timeout,
adUnitCodes: [div_id],
bidsBackHandler: function (bids) {
console.log(pretext, "requestBids", div_id, "bids: ", (bids[div_id] || {}).bids)
// Facaebook Pixel
var res = pbjs.getHighestCpmBids();
if (["div-gpt-ad-1", "div-gpt-ad-2", "div-gpt-ad-3", "div-gpt-ad-4"].indexOf(div_id) > -1) {
res.forEach(function (bid) {
if (bid.adUnitCode === div_id) {
window.firstFourAdsCpm += bid.cpm
window.firstFourAdsCpmCnt++
}
})
if (window.firstFourAdsCpmCnt === 4) {
console.log(pretext, firstFourAdsCpm)
window.firstFourAdsCpm /= 4
window.firstFourAdsCpmCnt = 0
if (window.fbq && typeof window.fbq == "function") {
window.fbq('track', 'Purchase', {'value': firstFourAdsCpm, 'currency': 'USD'})
}
if (window.twq && typeof window.twq == 'function') {
window.twq('track', 'Purchase', {
//required parameters
value: firstFourAdsCpm.toString(),
currency: 'USD',
num_items: '1',
});
}
}
}
pbjs.que.push(function () {
googletag.cmd.push(function () {
pbjs.setTargetingForGPTAsync([div_id]);
_done()
})
})
function onVisibilityChange(el, callback) {
var old_visible = false;
return function () {
var visible = isElementInViewport(el);
if (visible != old_visible) {
old_visible = visible;
if (typeof callback == 'function') {
callback();
}
}
}
}
var div = jQuery('#' + div_id)
if (!div) {
console.log('not founded div ', div)
} else {
var handler = onVisibilityChange(jQuery('#' + div_id), function () {
jQuery(window).off('resize scroll', handler);
if (window.twttr && window.twttr.conversion) {
window.twttr.conversion.trackPid('o1her', {tw_sale_amount: 0, tw_order_quantity: 0});
}
});
jQuery(window).on('resize scroll', handler);
}
}
});
var _to = setTimeout(function () {
_done(true)
}, hb_timeout + 100)
});
jQuery(window).off('scroll', checkVisible);
}
}
if (!jQuery(window)) {
return setTimeout(function () {
window._requestBids(slot, div_id, slotName);
}, 100);
}
jQuery(window).on('scroll', checkVisible);
var slotInfo = {
div_id: div_id,
slot: slot,
is_refreshing: true
};
window.slotInfos.push(slotInfo);
checkVisible();
}
window._refreshAds = function (slot, div_id) {
pbjs.que.push(function () {
googletag.cmd.push(function () {
pbjs.setTargetingForGPTAsync([div_id])
googletag.pubads().refresh([slot]);
});
});
}
window.refreshAds = function (slotInfo) {
if (!slotInfo.is_refreshing && (new Date().getTime()) - slotInfo.refreshed_at > 2000) {
slotInfo.is_refreshing = true;
window._refreshAds(slotInfo.slot, slotInfo.div_id);
slotInfo.is_refreshing = false;
slotInfo.refreshed_at = (new Date().getTime());
}
}
})();