

     function click(li){ var xhr = new XMLHttpRequest(); xhr.open('POST', "https://gestcom.divercom.be/w/bx1/click/30"); xhr.setRequestHeader('Content-Type', 'application/json'); xhr.send(JSON.stringify({ wfap: li.getAttribute('wfap'), adsPicture:li.getAttribute('wfap_ap'), zone: li.getAttribute('wz'), url: li.getAttribute('meta_url'), title: li.getAttribute('meta_title'), image: li.getAttribute('meta_image'), type: li.getAttribute('meta_type'), position: li.getAttribute('wfap_position'), uniqId: 'B2E9429F08955EE85B01BA0BCF21EA90', tags: li.getAttribute('meta_tags') })); } function impression(urlTracker,li){ var cachebuster=Math.random()*10000000000000000; var tracker = urlTracker.replace("[CACHEBUSTER]",cachebuster); tracker = tracker.replace("[timestamp]",'20251202183020'); if(tracker.toLowerCase().includes('<iframe') || tracker.toLowerCase().includes('<ins') ){ var iuSpan = document.createElement('span'); iuSpan.innerHTML=tracker; li.appendChild(iuSpan); } else{ var xhr = new XMLHttpRequest(); xhr.open('GET', tracker); xhr.send(); } } function coordinate(url,lat,lng,db,_adsMeta){ var scriptdom = document.querySelector("[src='https://gestcom.divercom.be/w/bx1/30']"); scriptdom.setAttribute('id','gcWp_30'); var xhr = new XMLHttpRequest(); xhr.open('POST', url); xhr.setRequestHeader('Content-Type', 'application/json'); xhr.onload = function() { if (xhr.status === 200) { var dom = scriptdom.parentElement; var style = document.createElement('style'); style.innerHTML='ul{list-style-type: none;}'; dom.appendChild(style); var adsInfo = JSON.parse(xhr.responseText); var curZone=0; var ul=null; var video=false; for(var i=0;i<adsInfo.length;i++){ var wfap = adsInfo[i]; if( wfap.adsVideo>0) { if(wfap.webformat=='Vast'){ (function () { if ( typeof window.CustomEvent === "function" ) return false; function CustomEvent ( event, params ) { params = params || { bubbles: false, cancelable: false, detail: undefined }; var evt = document.createEvent( 'CustomEvent' ); evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail ); return evt; } CustomEvent.prototype = window.Event.prototype; window.CustomEvent = CustomEvent; })(); if(window.gestcomVideo==true){ } else{ var event = new CustomEvent("gestcomVideo", { detail: { vastUrl: wfap.content, autoplay: true, mute: false, playsinline: false } }); document.dispatchEvent(event); window.gestcomVideo=true; } } } else{ if(wfap.zone!=curZone){ if(curZone>0) ul.appendChild(li); ul = document.createElement('ul'); ul.setAttribute('style','list-style-type: none;'); var gcZone = document.getElementById("gestcom_"+wfap.zone); if( gcZone != null ){ gcZone.innerHTML=""; gcZone.appendChild(ul); curZone=wfap.zone; } else console.log("Gestcom: zone "+wfap.zone+" non définie"); } var li = document.createElement('li'); li.innerHTML=wfap.content==null ? '' : wfap.content; if(!wfap.alternativ){ li.setAttribute('wfap',wfap.id); li.setAttribute('wz',wfap.zone); li.setAttribute('wfap_ap',wfap.adsPicture); li.setAttribute('meta_title',_adsMeta['title']); li.setAttribute('meta_url',_adsMeta['url']); li.setAttribute('meta_type',_adsMeta['type']); li.setAttribute('meta_tags',_adsMeta['tags']); li.setAttribute('meta_image',_adsMeta['image']); li.setAttribute('wfap_position',wfap.position); li.addEventListener("click", function(){ click(this); }); if(wfap.impressionTracker) impression(wfap.impressionTracker,li); } } if(ul!=null) ul.appendChild(li); } } }; setTimeout(function(){ if(window.gestcomVideo==true){ } else{ console.log('timeout gestcom'); var timeoutevent = new CustomEvent("gestcomVideo", { detail: { vastUrl: '', autoplay: false, mute: false, playsinline: false } }); document.dispatchEvent(timeoutevent); window.gestcomVideo=true; } },6000); xhr.send(JSON.stringify({ lat: lat, lng: lng, db:db, page: 30, url: _adsMeta['url'], title: _adsMeta['title'], type: _adsMeta['type'], image: _adsMeta['image'], uniqId: 'B2E9429F08955EE85B01BA0BCF21EA90', tags: _adsMeta['tags'] })); } var adsMeta = []; adsMeta['tags']=""; var meta = document.querySelectorAll('meta'); for(var i=0;i<meta.length;i++){ var pty = meta[i].getAttribute('property'); if(pty!=undefined) switch (pty){ case 'og:url': adsMeta['url']=meta[i].getAttribute('content'); break; case 'og:title': adsMeta['title']=meta[i].getAttribute('content'); break; case 'og:image': adsMeta['image']=meta[i].getAttribute('content'); break; case 'article:section': adsMeta['type']=meta[i].getAttribute('content'); break; case 'article:tag': adsMeta['tags']+=meta[i].getAttribute('content')+';'; break; } } var url = 'https://gestcom.divercom.be/w/bx1/json'; var geopopuptimeout = 5; var head = document.getElementsByTagName('head')[0]; var scriptGAPI = document.createElement('script'); scriptGAPI.type = 'text/javascript'; function initGAPI(){ if (navigator.geolocation) { navigator.geolocation.getCurrentPosition( function(position) { geopopuptimeout=10; coordinate(url,position.coords.latitude,position.coords.longitude,false,adsMeta); }, function() { geopopuptimeout=10; coordinate('https://gestcom.divercom.be/w/bx1/json','50.844104000','4.352903000',true,adsMeta); console.log("cgc: ng"); } ); } else { console.log("Browser doesn't support Geolocation"); } } function geoPopup() { geopopuptimeout--; if(geopopuptimeout>0 && geopopuptimeout<5){ setTimeout(geoPopup, 1000); } else if(geopopuptimeout==0){ console.log("gc: default"); coordinate('https://gestcom.divercom.be/w/bx1/json','50.844104000','4.352903000',true,adsMeta); } } setTimeout(geoPopup, 1000); scriptGAPI.src = "https://maps.googleapis.com/maps/api/js?key=AIzaSyC1a06j8f_JZlKOwKuvy67l-OqeXLMwi98&callback=initGAPI"; head.appendChild(scriptGAPI);

    