(function() { // criteo AD var head = document.getElementsByTagName('head')[0]; var script = document.createElement('script'); script.type = 'text/javascript'; script.src = 'https://static.criteo.net/js/ld/publishertag.js'; head.appendChild(script); window.Criteo = window.Criteo || {}; window.Criteo.events = window.Criteo.events || []; // ???? ?? param var criteo_ad_data = 'passback', criteo_ad_title = '', criteo_ad_click_url = '', criteo_ad_img_url = ''; var mobParam = "from=https%3A%2F%2Fwww.ytn.co.kr%2F_ln%2F0101_201809281948176545&s=432022", s = '432022', from = "https%3A%2F%2Fwww.ytn.co.kr%2F_ln%2F0101_201809281948176545", width = '740px', height = '238px', zoneId = '1557814', isLocalStorageUseYn = ('false' === 'true'), enliple_param = ""; var slotId = 'mobonDivBanner_'; if(zoneId!='') slotId = slotId+s; if('448695,448680'.match(s)){width='100%';height='auto'}; if(mobParam.indexOf('{param}') == -1) enliple_param = mobParam; if(from.indexOf('{from}') != -1) from = escape(location.href.replace(location.hash, "")); if(enliple_param.indexOf('from=') == -1) enliple_param = enliple_param + "&from=" + from; if(zoneId != "") enliple_param = enliple_param + "&criteo_zoneId=" + zoneId; enliple_param = enliple_param.replace(/amp%3B/g, ''); var ogUrlEle = document.querySelector("meta[property='og:url']"); var ogUrl = ''; if(typeof ogUrlEle !== 'undefined' && ogUrlEle !== null) { ogUrl = ogUrlEle.getAttribute("content"); var domain = window.location.hostname; if(ogUrl != null && ogUrl !== undefined && ogUrl !== '' && ogUrl.indexOf(domain) > -1){ enliple_param += "&ogUrl=" + escape(ogUrl); } } var mobonDomain = "https://native.mediacategory.com", div_prefix = 'mobonDivBanner_', ifr_prefix = 'mb_nt_cbw_frame_', isSendedPvCount = false, isLoadedFrame = false, isSendAuid = false, scrollEvent = function() { if (!isSendedPvCount) { var rect = document.getElementById(div_prefix + s).getBoundingClientRect(); var innerHeight = window.innerHeight || document.documentElement.clientHeight; if (rect.top >= 0 && innerHeight >= rect.top) { var message = { 'type' : 'mobon', 'action' : 'PvCount', 'scriptNo' : s }; document.getElementById(ifr_prefix + s).contentWindow.postMessage(JSON.stringify(message), mobonDomain); isSendedPvCount = true; } } }; /* * 05/18 ssp ? * ????????. */ var criteo_Imp_Url = ''; var init = function(){ var src = mobonDomain + "/servlet/adContentsBox?" + enliple_param; // ?? ???? ??? ????? ??? ?? ?? ????? var scriptNoList = ['432022','125824','31232']; if(zoneId != ''){ src += "&zoneId="+zoneId; } if(zoneId !='' && criteo_ad_data == 'passback' ){ src += "&criteo_ad_data=passback"; } // ???? ?? ?? ?????. // if(criteo_ad_data!=''){ // ?? ??. // src += "&criteo_ad_data="+encodeURIComponent(criteo_ad_data); // src += "&criteo_ad_data="+encodeURIComponent(encodeURI(criteo_ad_data, "UTF-8")); // } /* ???? ??? ?? ???. */ if(zoneId!='' && criteo_ad_data == 'external_ad_exist'){ console.log("criteo data create!"); var urls = ""; urls += ""; urls += "
"; urls += ""; urls += ""; urls += ""; urls += ""; urls += "
"; document.getElementById(div_prefix + s).innerHTML += urls; $("#criteostart").submit(); $("#criteostart").remove(); } else { console.log("no criteo AD!"); // IE?? includes ??? ???? /*if(scriptNoList.includes(s)) { document.getElementById(div_prefix + s).innerHTML += ""; } else { document.getElementById(div_prefix + s).innerHTML += ""; }*/ if(scriptNoList.indexOf(s) >= 0){ document.getElementById(div_prefix + s).innerHTML += ""; } else { document.getElementById(div_prefix + s).innerHTML += ""; } } document.getElementById(ifr_prefix + s).onload = function() { if (!isLoadedFrame) { if (window.addEventListener){ window.addEventListener('scroll', scrollEvent, false); } else { window.attachEvent('onscroll', scrollEvent); } // IE?? includes ??? ???? // if(scriptNoList.includes(s)) { // document.getElementById(ifr_prefix + s).style.width= width; // document.getElementById(ifr_prefix + s).style.height= height; // } if(scriptNoList.indexOf(s) >= 0){ document.getElementById(ifr_prefix + s).style.width= width; document.getElementById(ifr_prefix + s).style.height= height; } scrollEvent(); isLoadedFrame = true; } } } // ???? ???? ?? script var criteo_init = function(){ if(zoneId == "" || zoneId == null || zoneId == undefined){ criteo_ad_data = "passback"; console.log("criteo_ad_data:",criteo_ad_data); init(); }else{ var adUnits = { placements: [ { "slotId" : slotId, "zoneId" : zoneId, "nativeCallback": function(assets) { console.log("assets:",assets); if(assets!= undefined){ if(assets.products[0] != null && assets.products[0] != undefined){ var product = assets.products[0]; criteo_Imp_Url = JSON.stringify(assets.impression_pixels[0].url); criteo_ad_data = 'external_ad_exist'; criteo_ad_title = product.title; criteo_ad_click_url = product.click_url; criteo_ad_img_url = product.image.url; } } init(); } } ] }; var processCdbBid = function(){ var bids = Criteo.GetBidsForAdUnit(slotId); if (bids.length > 0) { var bidFound = bids[0]; Criteo.RenderAd({bidId: bidFound.id, containerId: bidFound.impressionId}); } else { passback(); } }; // ????? var passback = function(){ criteo_ad_data = "passback"; console.log("criteo_ad_data:",criteo_ad_data); init(); } Criteo.events.push(function () { Criteo.RequestBids(adUnits, processCdbBid, 2000); }); /* Criteo.events.push(function() { var adUnits = { placements: [ { "slotId" : slotId, "zoneId" : zoneId, "nativeCallback": function(assets) { criteo_ad_data = JSON.stringify(assets.products[0]); console.log("criteo_ad_data : ", criteo_ad_data); init(); } } ]} Criteo.Passback.RequestBids(adUnits , 2000); }); Criteo.events.push(function() { Criteo.Passback.RenderAd(slotId, function(){ criteo_ad_data = "passback"; console.log("criteo_ad_data : ", criteo_ad_data); init(); }); }); */ } } var agent = navigator.userAgent.toLowerCase(); if(isLocalStorageUseYn && agent.search("chrome/80") > -1) { var audiMessageEvent = function(e) { if(!isSendAuid){ var data = e.data; if(e.data !== null && typeof e.data !== 'undefined' && e.data !== '' && typeof e.data === 'string' && e.data.indexOf('mobon') !== -1){ data = JSON.parse(e.data); } if (data !== null && typeof data !== 'undefined' && data !== '' && data.type === 'mobon' && data.scriptNo === s && data.action === 'getAuid') { isSendAuid = true; enliple_param += ("&s_au_id=" + data.auid + "&s_IP_info=" + data.ipInfo); init(); } } }; if (window.addEventListener){ window.addEventListener('message', audiMessageEvent, false); } else { window.attachEvent('onmessage', audiMessageEvent); } document.getElementById(div_prefix + s).innerHTML += ""; var goTimeout = function(){ if(!isSendAuid){ criteo_init(); } } loadTimeout = setTimeout(goTimeout, 3000); } else { criteo_init(); } })();