[ad_1] Търсене вВсички сайтовеДнесЛайфКорнерБизнесITEMImpressioВремето ВсичкиАтелиеАрхитектураДизайнОотографияПалитраУлично изкуствоТатуСценаКиноТрейлърХорърБуквиНотиЛицаИнтервюПортретИкониНосталгияИзгубената БългарияВтори погледКалейдоскопЛюбопитноГурмеДушаИмпресио питаАфишПремиера ВсичкиОбществоКримиТемидаПолитикаИкономикаИнцидентиСвятСпектърМнениеНа фокусДИРектноРегиониСофияПловдивВарнаБургасРусеPR Zone ВсичкиЗвездиШоуМодаЗдраве и красотаМамаДомЛюбопитноVЯRAFIEDЛюбов и сексPR ZoneАкцентиДай лапаТествахме за вас ...Отново в час ВсичкиБутболТрите мачаТенисВолейболБаскетболF1БойниСектор КЛюбопитноСтатистикаПампионитеЕкстремниМоторниВ ъгълаВ мишенатаДруги ВсичкиИкономикаБанки и финансиКомпанииПазариИмотиМаркетинг и рекламаЕкспертно мнениеПортфейлPR Zone ВсичкиНаукаТехнологииКомуникацииИгриДжаджиWebРевюPR Zone ВсичкиНовиниПътна обстановка ОбхватЦялата статияЗаглавиеАвтор ПодредбаПо датаПо точност ДатаНезависимо когаПоследните 24 часаПоследната седмицаПоследния месецПоследната годинаКонкретен период faktorScript.addEventListener("load", function () { // Firing the check consent data object on the event cmpReady window.__cmp('addEventListener', 'cmpReady', function() { checkConsentDataWithCallback(); }); function checkConsentDataWithCallback() { window.__cmp('consentDataExist', true, function(consentDataExist) { if (consentDataExist) { //checkGoogleAdManagerConsent(); //checkFacebookConsent(); //checkOneSignalConsent(); //checkGoogleAnalyticsConsent(); //checkGemiusConsent(); } }); } // checkGoogleAdManagerConsent checks if the vendor and its purposes are set to true Then fires the GoogleAdManagerScript() var checkGoogleAdManagerConsent = function() { console.log('Faktor.io CMP: checkGoogleAdManagerConsent'); window.__cmp('getVendorConsents', undefined, function(data) { var consentForGoogleAdManager = (data.purposeConsents[1] && data.purposeConsents[2] && data.purposeConsents[3] && data.purposeConsents[4] && data.purposeConsents[5]) console.log("Consent status for Google AdManager vendor and it purposes is", consentForGoogleAdManager); GoogleAdManagerScript(consentForGoogleAdManager); }); } // checkFacebookConsent checks if the vendor and its purposes are set to true Then fires the FacebookScript() var checkFacebookConsent = function() { console.log('Faktor.io CMP: checkFBConsent'); window.__cmp('getAdditionalVendorConsents', undefined, function(data) { var consentForFaceBook = (data.purposeConsents[1] && data.purposeConsents[2] && data.purposeConsents[3] && data.purposeConsents[5] && data.vendorConsents[16]) console.log("Consent status for facebook vendor and it purposes is", consentForFaceBook); if (consentForFaceBook) { FacebookScript(); } }); } var checkOneSignalConsent = function(){ console.log('Faktor.io CMP: checkOneSignalConsent'); window.__cmp('getAdditionalVendorConsents', undefined, function(data) { var consentForOneSignal = (data.purposeConsents[1] && data.purposeConsents[2] && data.vendorConsents[9]) console.log("Consent status for One Signal vendor and it purposes is", consentForOneSignal); if (consentForOneSignal) { OneSignalScript(); } }); } var checkGoogleAnalyticsConsent = function(){ console.log('Faktor.io CMP: checkGoogleAnalyticsConsent'); window.__cmp('getAdditionalVendorConsents', undefined, function(data) { var consentForGoogleAnalytics = (data.purposeConsents[1] && data.purposeConsents[5] && data.vendorConsents[4]) console.log("Consent status for Google Analytics vendor and it purposes is", consentForGoogleAnalytics); if (consentForGoogleAnalytics) { GoogleAnalyticsScript(); } }); } var checkGemiusConsent = function(){ console.log('Faktor.io CMP: checkGemiusConsent'); window.__cmp('getVendorConsents', undefined, function(data) { var consentForGemius = (data.purposeConsents[1] && data.purposeConsents[2] && data.purposeConsents[3] && data.purposeConsents[4] && data.purposeConsents[5] && data.vendorConsents[328]) console.log("Consent status for Gemius vendor and it purposes is", consentForGemius); if (consentForGemius) { GemiusScript(); } }); } // one Signal is palced in a function function OneSignalScript(){ if (typeof window.OneSignal === 'undefined') { var oneSignalFirstScript = document.createElement('link'); oneSignalFirstScript.rel = 'manifest'; oneSignalFirstScript.href = 'https://static.dir.bg/one_signal/manifest.json'; var oneSignalSecondScript = document.createElement('script'); oneSignalSecondScript.src = 'https://cdn.onesignal.com/sdks/OneSignalSDK.js'; oneSignalSecondScript.async = ''; var oneSignalThirdScript = document.createElement('script'); var oneSignalThirdScriptContents = document.createTextNode( "var OneSignal = window.OneSignal || [];" + "OneSignal.push(function() {" + " OneSignal.init({" + " appId: '2f11f6ce-5e75-4b3c-9607-5257337795cf'," + " safari_web_id: 'web.onesignal.auto.370dd028-ab8a-4720-9087-4e2c917686de'," + " autoRegister: true" + " });" + "});" ); oneSignalThirdScript.appendChild(oneSignalThirdScriptContents); document.getElementsByTagName('head')[0].insertAdjacentElement('beforeend', oneSignalFirstScript); document.getElementsByTagName('head')[0].insertAdjacentElement('beforeend', oneSignalSecondScript); document.getElementsByTagName('head')[0].insertAdjacentElement('beforeend', oneSignalThirdScript); } console.log('OneSignalScript Custom tag'); } // facebook script is placed in a function. function FacebookScript() { !function(f,b,e,v,n,t,s) {if(f.fbq)return;n=f.fbq=function(){n.callMethod? n.callMethod.apply(n,arguments):n.queue.push(arguments)}; if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; n.queue=[];t=b.createElement(e);t.async=!0; t.src=v;s=b.getElementsByTagName(e)[0]; s.parentNode.insertBefore(t,s)}(window, document,'script', 'https://connect.facebook.net/en_US/fbevents.js'); fbq('init', '691519781247680'); fbq('track', 'PageView'); console.log("FacebookScript Custom tag"); } function GoogleAnalyticsScript() { (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-436010-19', 'dir.bg'); ga('send', 'pageview'); console.log("GoogleAnalyticsScript Custom tag"); } function GemiusScript() { var gemiusScript = document.createElement('script'); gemiusScript.type = 'text/javascript'; var gemiusScriptContent = document.createTextNode( "" ); gemiusScript.appendChild(gemiusScriptContent); document.getElementsByTagName('head')[0].insertAdjacentElement('beforeend', gemiusScript); console.log("GemiusScript Custom tag"); } function GoogleAdManagerScript(consentForAds) { googletag.cmd.push(function() { googletag.pubads().setRequestNonPersonalizedAds(consentForAds ? 0 : 1); googletag.pubads().refresh(); }); console.log("Google AdManager Custom tag"); } // this function will trigger the check for facebook again to see if consent is still true or not. function confirmRefresh() { //checkGoogleAdManagerConsent(); //checkFacebookConsent(); //checkOneSignalConsent(); //checkGoogleAnalyticsConsent(); //checkGemiusConsent(); } // checking if the consent object still excist, if true trigger check for consent, if false, user is new. function checkConsentDataWithCallbackAgain() { window.__cmp('consentDataExist', true, function(consentDataExist) { if (consentDataExist) { confirmRefresh(); } }); } //Checks the consent status again when changing the consent window.__cmp('addEventListener', 'consentChanged', function() { checkConsentDataWithCallbackAgain(); }); }); !function(f,b,e,v,n,t,s) {if(f.fbq)return;n=f.fbq=function(){n.callMethod? n.callMethod.apply(n,arguments):n.queue.push(arguments)}; if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; n.queue=[];t=b.createElement(e);t.async=!0; t.src=v;s=b.getElementsByTagName(e)[0]; s.parentNode.insertBefore(t,s)}(window, document,'script', 'https://connect.facebook.net/en_US/fbevents.js'); fbq('init', '691519781247680'); fbq('track', 'PageView'); [ad_2]