{ pbjs.addAdUnits(this.ADUNITDISPLAY); pbjs.addAdUnits(this.ADUNITVIDEO); pbjs.setConfig({ priceGranularity: this.PRICE, enableSendAllBids: true, cache: { url: ‘https://prebid.adnxs.com/pbc/v1/cache’ }, // bidderTimeout: 2000, }); pbjs.requestBids({ bidsBackHandler: this.initAdserver, timeout: this.PREBID_TIMEOUT, }); }); } initAdserver() { if (pbjs.initAdserverSet) return; pbjs.initAdserverSet = true; // Get all of the adUnit codes for the display adUnits var displayAdUnitCodes = []; adUnitsDisplay.forEach(function(adUnit) { displayAdUnitCodes.push(adUnit.code); //console.log(adUnit.code); }); googletag.cmd.push(function() { pbjs.que.push(function() { pbjs.setTargetingForGPTAsync(displayAdUnitCodes); googletag.pubads().refresh([window.GAMLibrary.showcase]); googletag.pubads().refresh([window.GAMLibrary.halfpage1]); googletag.pubads().refresh([window.GAMLibrary.halfpage2]); googletag.pubads().refresh([window.GAMLibrary.leaderboard]); }); }); } } /** START – PREBID INITIATE CLASS */ /** START – PREBID INIT, CONFIGURATION & GOOGLE INIT */ const priceGranularityConfig = { buckets: [{ precision: 2, min: 0.02, max: 2.99, increment: 0.01 }, { precision: 2, min: 3, max: 10, increment: 0.1 }, ], }; var gptadslots = []; var googletag = googletag || {}; var pbjs = pbjs || {}; var adUnitsDisplay = [{ code: “div-gpt-ad-liputan6-sc”, mediaTypes: { banner: { sizes: [ [300, 250], [250, 250], ], }, }, bids: [{ bidder: “innity”, params: { zone: 98038, pub: 539 } }, { bidder: “teads”, params: { pageId: 153492, placementId: 167804 } }, { bidder: “grid”, params: { uid: 357300, bidFloor: 0.12 } }, { bidder: ‘pubmatic’, params: { publisherId: ‘156536’, adSlot: ‘Prebid-Liputan6-Mobile-300×250’ } }, { bidder: ‘unruly’, params: { siteId: 243584 } }, { bidder: ‘medianet’, params: { cid: ‘8CUWX4UX4’, crid: ‘576550861’ } }, { bidder: ‘smartadserver’, params: { domain: ‘https://prg-apac.smartadserver.com’, networkId: 4221, siteId: 498334, pageId: 1556526, formatId: 111310 } }, { bidder: “openx”, params: { delDomain: “emtek-d.openx.net”, unit: “556894079” } }, { bidder: ‘ix’, params: { siteId: ‘802764’ } }, ], }, { code: “div-gpt-ad-liputan6-halfpage1”, mediaTypes: { banner: { sizes: [ [300, 250], [300, 600], [160, 600], ], }, }, bids: [{ bidder: “innity”, params: { zone: 97891, pub: 536 } }, { bidder: “teads”, params: { pageId: 153492, placementId: 167804 } }, { bidder: “grid”, params: { uid: 357301, bidFloor: 0.12 } }, { bidder: ‘pubmatic’, params: { publisherId: ‘156536’, adSlot: ‘Prebid-Liputan6-Mobile-300×600’ } }, { bidder: ‘unruly’, params: { siteId: 243584 } }, { bidder: ‘medianet’, params: { cid: ‘8CUWX4UX4’, crid: ‘123558562’ } }, { bidder: ‘smartadserver’, params: { domain: ‘https://prg-apac.smartadserver.com’, networkId: 4221, siteId: 498334, pageId: 1556526, formatId: 111311 } }, { bidder: “openx”, params: { delDomain: “emtek-d.openx.net”, unit: “556894083” } }, { bidder: ‘ix’, params: { siteId: ‘802765’ } }, ], }, { code: “div-gpt-ad-liputan6-halfpage2”, mediaTypes: { banner: { sizes: [ [300, 250], [300, 600], [160, 600], ], }, }, bids: [{ bidder: “innity”, params: { zone: 97891, pub: 536 } }, { bidder: “teads”, params: { pageId: 153492, placementId: 167804 } }, { bidder: “grid”, params: { uid: 357302, bidFloor: 0.12 } }, { bidder: ‘pubmatic’, params: { publisherId: ‘156536’, adSlot: ‘Prebid-Liputan6-Mobile-300×600’ } }, { bidder: ‘unruly’, params: { siteId: 243584 } }, { bidder: ‘medianet’, params: { cid: ‘8CUWX4UX4’, crid: ‘123558562’ } }, { bidder: ‘smartadserver’, params: { domain: ‘https://prg-apac.smartadserver.com’, networkId: 4221, siteId: 498334, pageId: 1556526, formatId: 111311 } }, { bidder: “openx”, params: { delDomain: “emtek-d.openx.net”, unit: “556894083” } }, { bidder: ‘ix’, params: { siteId: ‘802766’ } }, ], }, { code: “div-gpt-ad-liputan6-lb”, mediaTypes: { banner: { sizes: [ [728, 90], [970, 90], [970, 250], ], }, }, bids: [{ bidder: ‘smartadserver’, params: { domain: ‘https://prg-apac.smartadserver.com’, networkId: 4221, siteId: 498334, pageId: 1556526, formatId: 111313 } }, { bidder: ‘ix’, params: { siteId: ‘802763’ } }, { bidder: “grid”, params: { uid: 357303, bidFloor: 0.12 } }, { bidder: “teads”, params: { pageId: 153492, placementId: 167804 } }, ], }, ]; var adUnitsVideo = [{ code: “div-gpt-ad-liputan6-sc”, mediaTypes: { video: { playerSize: [300, 250], // Not set so that the player can be repsonsive context: “outstream”, protocols: [2, 3, 7] }, }, bids: [{ bidder: “spotx”, params: { channel_id: 285432, ad_unit: “outstream”, outstream_function: spotxOutstreamFunc } }, { bidder: ‘ix’, params: { siteId: ‘802764’ } }, ], }, { code: “div-gpt-ad-liputan6-halfpage1”, mediaTypes: { video: { playerSize: [300, 600], // Not set so that the player can be repsonsive context: “outstream”, protocols: [2, 3, 7] }, }, bids: [{ bidder: “spotx”, params: { channel_id: 285432, ad_unit: “outstream”, outstream_function: spotxOutstreamFunc } }, { bidder: ‘ix’, params: { siteId: ‘802765’ } }, ], }, { code: “div-gpt-ad-liputan6-halfpage2”, mediaTypes: { video: { playerSize: [300, 600], // Not set so that the player can be repsonsive context: “outstream”, protocols: [2, 3, 7] }, }, bids: [{ bidder: “spotx”, params: { channel_id: 285432, ad_unit: “outstream”, outstream_function: spotxOutstreamFunc } }, { bidder: ‘ix’, params: { siteId: ‘802766’ } }, ], }, { code: “div-gpt-ad-liputan6-lb”, mediaTypes: { video: { playerSize: [970, 250], // Not set so that the player can be repsonsive context: “outstream”, protocols: [2, 3, 7] }, }, bids: [{ bidder: ‘ix’, params: { siteId: ‘802763’ } }, ], }, ]; pbjs.que = pbjs.que || []; googletag.cmd = googletag.cmd || []; /** END – PREBID INIT, CONFIGURATION & GOOGLE INIT */ /*PROTOTYPE CUSTOM FILTERING*/ String.prototype.klyFiltering = function(delimiter) { return this.trim().split(delimiter).map(function(t) { return t.trim().toLowerCase() }).filter(x => x != “”); }; window.GAMLibrary = {}; window.GAMLibrary = { gamImmersive: ‘/36504930/KLY/DESKTOP/LIPUTAN6.COM/IMMERSIVE’, gamTopFrame: ‘/36504930/KLY/DESKTOP/LIPUTAN6.COM/TOP_FRAME’, gamBottomFrame: ‘/36504930/KLY/DESKTOP/LIPUTAN6.COM/BOTTOM_FRAME’, gamSkinad: ‘/36504930/KLY/DESKTOP/LIPUTAN6.COM/SKINAD’, gamBillboard: ‘/36504930/KLY/DESKTOP/LIPUTAN6.COM/MASTHEAD’, gamShowcase: ‘/36504930/KLY/DESKTOP/LIPUTAN6.COM/SHOWCASE’, gamHalfpage1: ‘/36504930/KLY/DESKTOP/LIPUTAN6.COM/HALFPAGE_1’, gamHalfpage2: ‘/36504930/KLY/DESKTOP/LIPUTAN6.COM/HALFPAGE_2’, gamLeaderboard: ‘/36504930/KLY/DESKTOP/LIPUTAN6.COM/LEADERBOARD’, gamBalloon: ‘/36504930/KLY/DESKTOP/LIPUTAN6.COM/BALLOON’, gamHeadline1: ‘/36504930/www.liputan6.com/dfp-headline1’, gamHeadline2: ‘/36504930/www.liputan6.com/dfp-headline2’, gamNewsTag1: ‘/36504930/KLY/DESKTOP/LIPUTAN6.COM/NEWS_TAG_1’, gamNewsTag2: ‘/36504930/KLY/DESKTOP/LIPUTAN6.COM/NEWS_TAG_2’, gamOrganicFeedCRM1: ‘/36504930/KLY/DESKTOP/LIPUTAN6.COM/ORGANIC_FEED_CRM_1’, gamOrganicFeedCRM2: ‘/36504930/KLY/DESKTOP/LIPUTAN6.COM/ORGANIC_FEED_CRM_2’, gamOrganicFeedCRM3: ‘/36504930/KLY/DESKTOP/LIPUTAN6.COM/ORGANIC_FEED_CRM_3’, userAgent: navigator.userAgent.toLowerCase(), GAMisTablet: /(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(this.userAgent), tags: ”, documentMeta: function(metaName) { var metaResult = ”; var metas = document.getElementsByTagName(‘meta’); if (metas) { for (var x = 0, y = metas.length; x :not(.baca-juga)”), arrTexts = [], siteContentText = ”; for (var i = 0; i 0) { if (matchString = new RegExp(“\b(” + subKeywordList.join(“|”) + “)\b”, “ig”).exec(siteContentText)) { bsKeyword.push(bsKey); } } } if (bsKeyword.length > 0) { googletag.pubads().setTargeting(“bsKeyword”, bsKeyword); /*Temporary preserve the previous brand safety targeting*/ googletag.pubads().setTargeting(“isMatcont”, isMatcont); googletag.pubads().setTargeting(“brandsafety”, isViolateBrandSafety); } }, onMessageReceivedGPTUpdateCreativeStyle: function() { this.onMessageReceivedGetStyle = function(e) { /** filter only correct origin and setStyle command */ if (!(e.origin.match(/safeframe.googlesyndication.com/ig)) || typeof e.data !== ‘object’ || typeof e.data.id !== ‘string’ || e.data.cmd !== ‘setStyle’ || typeof e.data.params !== ‘object’ ) { return; } /* remove # character from id, we don’t use jquery*/ var elementId = e.data.id.replace(/#/, “”); var wrapperEl = document.getElementById(elementId); if (wrapperEl === null) { return; } var elements = [wrapperEl]; /*target on KLY authorized element child ( div and iframe ) */ if (typeof e.data.query === ‘string’ && e.data.query) { let el = null; if (el = e.data.query.match(/(div|iframe)/ig)) { elements = wrapperEl.querySelectorAll(el.join(“, “)); } } /** target on KLY authorized attribute ( display, heigth, width ) */ elements.forEach(function(element) { Object.keys(e.data.params).forEach(function(param) { let allowedAttr = [‘display’, ‘height’, ‘width’]; allowedAttr.indexOf(param) > -1 ? (element.style[param] = e.data.params[param]) : ”; }); }); } if (window.addEventListener) { window.addEventListener(‘message’, this.onMessageReceivedGetStyle, false); } else { if (window.attachEvent) { window.attachEvent(‘onmessage’, this.onMessageReceivedGetStyle); } else { window.onmessage = this.onMessageReceivedGetStyle; } } } } /* DMP CATEGORY LIST */ window.createDMPTracker = function(adsCatList, dfpTracker, macro) { window.createCDPTracker(adsCatList, macro); parent.window.open(dfpTracker, ‘_blank’); }; window.createCDPTracker = function(cat, macro) { var cName = ‘ahoy_visitor=’, cVisitorId = document.cookie.split(‘;’).find(v => { return v.match(cName); }), partnerUID = cVisitorId ? decodeURIComponent(cVisitorId).trim().replace(cName, ”) : 0, gamMacro = typeof macro === “string” ? JSON.parse(macro) : macro, defaultKey = { adunitId: “ads_adunit_id”, advertiserId: “ads_advertiser_id”, creativeId: “ads_creative_id”, lineitemId: “ads_lineitem_id”, orderId: “ads_order_id”, }; actionDetails = Object.keys(gamMacro).reduce((obj, k) => Object.assign(obj, defaultKey[k] ? { [defaultKey[k]]: gamMacro[k] } : { [k]: gamMacro[k] }), {}), cdpData = { action: actionDetails.action ? actionDetails.action : ‘ads_click’, action_category: cat, action_details: actionDetails.action ? (delete actionDetails.action, actionDetails = actionDetails) : actionDetails, visitor_id: partnerUID }; //partnerUID ? window.VidioPersonalization.sendData(null, cdpData) : ”; //partnerUID ? window.AhoyEvent.sendPersonalizationUserEvent(cdpData) : ”; (actionDetails.action == ‘ads_click’) ? (partnerUID ? window.AhoyEvent.sendPersonalizationUserEvent(cdpData) : ”) : ”; }; googletag.cmd.push(function() { var urlPath = document.URL; window.GAMLibrary.brandSafetyChecker(); /* DEFINE IMMERSIVE TAG – DO NOT CHANGE THE SLOT ORDER, IMMERSIVE ALWAYS ON THE 1st POSITION – */ window.GAMLibrary.immersive = googletag.defineOutOfPageSlot(GAMLibrary.gamImmersive, ‘div-gpt-ad-liputan6-immersive-oop’).addService(googletag.pubads()); window.GAMLibrary.showcase = googletag.defineSlot(GAMLibrary.gamShowcase, [ [300, 250], [250, 250] ], ‘div-gpt-ad-liputan6-sc’).addService(googletag.pubads()); window.GAMLibrary.halfpage1 = googletag.defineSlot(GAMLibrary.gamHalfpage1, [ [300, 250], [300, 600], [160, 600] ], ‘div-gpt-ad-liputan6-halfpage1’).addService(googletag.pubads()); window.GAMLibrary.halfpage2 = googletag.defineSlot(GAMLibrary.gamHalfpage2, [ [300, 250], [300, 600], [160, 600] ], ‘div-gpt-ad-liputan6-halfpage2’).addService(googletag.pubads()); window.GAMLibrary.leaderboard = googletag.defineSlot(GAMLibrary.gamLeaderboard, [ [970, 90], [728, 90], [970, 250] ], ‘div-gpt-ad-liputan6-lb’).addService(googletag.pubads()).setTargeting(“leaderboard_type”, [‘direct’]); /*OUT OF PAGE SLOT*/ window.GAMLibrary.ballon = googletag.defineOutOfPageSlot(GAMLibrary.gamBalloon, ‘div-gpt-ad-liputan6-balloon-oop’).addService(googletag.pubads()); window.GAMLibrary.headline1 = googletag.defineOutOfPageSlot(GAMLibrary.gamHeadline1, ‘div-gpt-ad-liputan6-dfp-headline1-oop’).addService(googletag.pubads()); window.GAMLibrary.headline2 = googletag.defineOutOfPageSlot(GAMLibrary.gamHeadline2, ‘div-gpt-ad-liputan6-dfp-headline2-oop’).addService(googletag.pubads()); window.GAMLibrary.newstag1 = googletag.defineOutOfPageSlot(GAMLibrary.gamNewsTag1, ‘div-gpt-ad-liputan6-newsTag1-oop’).addService(googletag.pubads()); window.GAMLibrary.newstag2 = googletag.defineOutOfPageSlot(GAMLibrary.gamNewsTag2, ‘div-gpt-ad-liputan6-newsTag2-oop’).addService(googletag.pubads()); window.GAMLibrary.organicFeedCRM1 = googletag.defineOutOfPageSlot(GAMLibrary.gamOrganicFeedCRM1, ‘div-gpt-ad-liputan6-crm1-oop’).addService(googletag.pubads()); window.GAMLibrary.organicFeedCRM2 = googletag.defineOutOfPageSlot(GAMLibrary.gamOrganicFeedCRM2, ‘div-gpt-ad-liputan6-crm2-oop’).addService(googletag.pubads()); window.GAMLibrary.organicFeedCRM3 = googletag.defineOutOfPageSlot(GAMLibrary.gamOrganicFeedCRM3, ‘div-gpt-ad-liputan6-crm3-oop’).addService(googletag.pubads()); googletag.pubads().addEventListener(‘slotRenderEnded’, function(event) { var dfp_slotElementId = event.slot.getSlotId().getDomId(); var containerId = event.slot.getSlotElementId(); var containerEl = document.getElementById(containerId); if (event.slot == window.GAMLibrary.immersive) { if (event.isEmpty) { gam_billboard = googletag.defineOutOfPageSlot(GAMLibrary.gamBillboard, ‘div-gpt-ad-liputan6-billboard-oop’).addService(googletag.pubads()); gam_topfrm = googletag.defineOutOfPageSlot(GAMLibrary.gamTopFrame, ‘div-gpt-ad-liputan6-topfrm-oop’).addService(googletag.pubads()); gam_bottomfrm = googletag.defineSlot(GAMLibrary.gamBottomFrame, [468, 60], ‘div-gpt-ad-liputan6-bottomfrm-oop’).addService(googletag.pubads()); if (!GAMLibrary.GAMisTablet) { gam_skinad = googletag.defineOutOfPageSlot(GAMLibrary.gamSkinad, ‘div-gpt-ad-liputan6-skinad-oop’).addService(googletag.pubads()); googletag.pubads().refresh([gam_billboard, gam_topfrm, gam_bottomfrm, gam_skinad]); } else { googletag.pubads().refresh([gam_billboard, gam_topfrm, gam_bottomfrm]); } } } if (containerEl !== null) { var iframeEl = containerEl.querySelectorAll(‘iframe’)[0]; /* it’s delayed by 10 milliseconds, because iframe is not yet fully rendered and limited to max to 10 seconds to wait*/ var timeoutFunction = function() { var src = “#” + containerId; /* `src` attribute is null, when iframe is FriendlyIframe, and when it’s present, then it’s SafeFrame */ if (iframeEl) { if ((iframeEl.getAttribute(‘src’) !== null)) { src = iframeEl.getAttribute(‘src’).replace(/#.*/, “”) + src; } else { var name = iframeEl.getAttribute(‘name’) + “#” + containerId; iframeEl.setAttribute(‘name’, name); } iframeEl.setAttribute(‘src’, src); } }; setTimeout(timeoutFunction, 10); } }); /* START – SEND IMPRESSION DATA TO CDP */ googletag.pubads().addEventListener(‘slotOnload’, function(event) { var dfp_slotDelivered = event.slot.getResponseInformation() ? ‘block’ : ‘none’; /* check wheter there is ads or not*/ if (dfp_slotDelivered == ‘block’) { cdpData = { action: ‘ads_impression’, action_details: { slotElementId: event.slot.getSlotElementId(), ResponseInformation: event.slot.getResponseInformation(), sizes: event.slot.getSizes(), adunitPath: event.slot.getAdUnitPath(), outOfPage: event.slot.getOutOfPage() } }; window.AhoyEvent.sendPersonalizationUserEvent(cdpData); } }); /* END – SEND IMPRESSION DATA TO CDP */ /* INITIATE INFINITE SC */ GAMLibrary.initiateInfiniteSC(); /* START TARGETING BLOCK */ googletag.pubads().setTargeting(“tags”, window.GAMLibrary.tags); googletag.pubads().setTargeting(“currentUrl”, urlPath); googletag.pubads().setTargeting(“platform”, kmklabs.platform); googletag.pubads().setTargeting(“type”, kmklabs.gtm.type); googletag.pubads().setTargeting(“pageType”, kmklabs.pageType); googletag.pubads().setTargeting(“channel”, kmklabs.gtm.subCategory); googletag.pubads().setTargeting(“audience”, kmklabs.gtm.audience.split(“|”)); googletag.pubads().setTargeting(“isAdvertorial”, typeof(isAdvertorial = kmklabs.article && kmklabs.article.isAdvertorial.toString()) === “undefined” ? “false” : isAdvertorial); googletag.pubads().setTargeting(“isMultipage”, typeof(isMultipage = kmklabs.article && kmklabs.article.isMultipage.toString()) === “undefined” ? “false” : isMultipage); googletag.pubads().setTargeting(“articleId”, kmklabs.gtm.articleId.toString()); googletag.pubads().setTargeting(“site”, kmklabs.site); googletag.pubads().setTargeting(“age”, typeof(age = kmklabs.gtm.age) === “undefined” ? “false” : kmklabs.gtm.age.toString()); googletag.pubads().setTargeting(“gender”, typeof(gender = kmklabs.gtm.gender) === “undefined” ? “false” : kmklabs.gtm.gender.toString()); googletag.pubads().setTargeting(“subcategory”, kmklabs.gtm.subCategory); /* END TARGETING BLOCK */ /* SET VISITOR ID AS PUBLISHER PROVIDED ID – START*/ var cVisitorId = (visId = document.cookie.split(“ahoy_visitor”)[1]) ? visId.split(‘;’)[0].replace(/[^a-zA-Z0-9]/ig, ”) : false; if (cVisitorId) { googletag.pubads().setPublisherProvidedId(cVisitorId + ‘kly’); } /* SET VISITOR ID AS PUBLISHER PROVIDED ID – END*/ googletag.pubads().setCentering(true); googletag.pubads().enableSingleRequest(); googletag.pubads().collapseEmptyDivs(); googletag.pubads().disableInitialLoad(); googletag.enableServices(); googletag.pubads().refresh([window.GAMLibrary.immersive, window.GAMLibrary.ballon, window.GAMLibrary.headline1, window.GAMLibrary.headline2, window.GAMLibrary.newstag1, window.GAMLibrary.newstag2, window.GAMLibrary.organicFeedCRM1, window.GAMLibrary.organicFeedCRM2, window.GAMLibrary.organicFeedCRM3]); }); /* INITIATE PREBID */ var prebidObject = new PrebidInstantiate(1000, 3000, 1000, adUnitsDisplay, adUnitsVideo, priceGranularityConfig); /** GET MESSAGE FROM SAFEFRAME CONTAINER */ GAMLibrary.onMessageReceivedGPTUpdateCreativeStyle(); /** GET MESSAGE FROM SAFEFRAME CONTAINER */ ]]>

Source

Leave a Reply

Your email address will not be published.