var dml_blmr = dml_blmr || {}; if (/localhost/g.test("https://bioluminc.com") || /192\.168\.0\./g.test("https://bioluminc.com")){ dml_blmr.logAllFlag = true; }else{ dml_blmr.logAllFlag = false; } dml_blmr.isEmbed = dml_blmr.isEmbed || true; dml_blmr.forced_language = dml_blmr.forced_language || ""; dml_blmr.addToBagFlag = false; if (!dml_blmr.bannerTexts){ dml_blmr.bannerTexts = { title: 'find your light', cta: 'show me how' }; } dml_blmr.widget_wrapper=document.getElementById("dml_blmr_wrapper"); //var dml_blmr.widget_wrapper = document.getElementById("dml_blmr_wrapper"); dml_blmr.debug = function(inStringBefore,inVariable){ if ( dml_blmr.logAllFlag){ inStringBefore = (inStringBefore === undefined) ? '' : inStringBefore; if (inVariable == undefined){ console.log(inStringBefore) }else{ console.log(inStringBefore, inVariable) } } } // GA - START dml_blmr.GAsetup = false; dml_blmr.sendGA = function(eventName,eventParameters = {}){ if (!window.gtag) return; if (!dml_blmr.GAsetup) return; var parametersAsString; try{ parametersAsString = JSON.stringify(eventParameters); dml_blmr.debug("GOOGLE ANALYTICS: " + eventName + " - " + parametersAsString); }catch(err){ console.warn("Error in GA event parameters - ",err); eventParameters={}; } window.gtag('event', eventName, eventParameters); } dml_blmr.setupGA = function(){ if (window.gtag) { dml_blmr.debug("setting up GA with 'gtag'"); window.gtag('config', "G-VE7MJHDRXR"); dml_blmr.GAsetup = true; } } // GA - END dml_blmr.getEmbedHtmlData = function(url, callback){ var request = new XMLHttpRequest(); request.open('GET', url, true); request.onload = function() { if (request.status >= 200 && request.status < 400) { callback({"status": "success","status_code":request.status, "data" : request.responseText}); } else { callback({"status": "success","status_code":request.status, "data" : "We reached our target server, but it returned an error"}); } }; request.onerror = function() { callback({"error": "success","status_code":request.status, "data" : "Error occured in getting html data"}); }; request.send(); } dml_blmr.getScript = function(source, callback) { var script = document.createElement('script'); script.async = 1; script.onload = function(evt) { callback({"status":"success","message":"done"}); }; script.onerror = function(err){ console.log(err) callback({"status":"error", "message":"error in getting script " + source}); } script.setAttribute('type','text/javascript'); script.src = source; dml_blmr.widget_wrapper.appendChild(script); } dml_blmr.getScript_withAttributes = function(source, attributeObj, callback) { var script = document.createElement('script'); script.async = 1; script.onload = function(evt) { callback({"status":"success","message":"done"}); }; script.onerror = function(err){ console.log(err) callback({"status":"error", "message":"error in getting script " + source}); } script.setAttribute('type','text/javascript'); try{ Object.keys(attributeObj).forEach( function(attrKey){ script.setAttribute(attrKey,attributeObj[attrKey]); }); }catch(err){ console.log(err); } script.src = source; dml_blmr.widget_wrapper.appendChild(script); } dml_blmr.openApp = function(){ var gaTimer = 100; var checkForWindowGA = true; var gacheckinterval = setInterval(function(){ if (window.gtag){ dml_blmr.debug("GA AVAILABLE - "+ gaTimer/1000 + "s",""); clearInterval(gacheckinterval); dml_blmr.setupGA(); }else{ if (checkForWindowGA){ if (window.ga){ checkForWindowGA = false; console.log("found ga but not gtag - adding gtag library"); dml_blmr.getScript("https://www.googletagmanager.com/gtag/js?id=G-VE7MJHDRXR",function(res){ window.dataLayer = window.dataLayer || []; window.gtag = function(){dataLayer.push(arguments);} gtag('js', new Date()); }); } } if (gaTimer > 20000){ dml_blmr.debug("GA NOT AVAILABLE - "+ gaTimer/1000 + "s"); clearInterval(gacheckinterval); } gaTimer += 100; } },100) if (document.getElementById("blmr_banner_container")){ document.getElementById("blmr_banner_container").style.display="none" } if (navigator.appName == 'Microsoft Internet Explorer' || !!(navigator.userAgent.match(/Trident/) || navigator.userAgent.match(/rv:11/))){ setTimeout(function(){dml_blmr.sendGA("flow",{action: "showing browser not supported screen", page_title: "landing_page", page_location: window.location.hostname, page_path: window.location.pathname});},2000); //alert("We don't currently support this browser. Please reopen this page in a different browser.") if (!dml_blmr.isEmbed){ dml_blmr.widget_wrapper.style.height = window.innerHeight + "px"; } dml_blmr.widget_wrapper.innerHTML = '

We don\'t currently support this browser. Please reopen this page in a different browser, such as Chrome.

' + dml_blmr.widget_wrapper.innerHTML; if (dml_blmr.widget_wrapper.offsetWidth >= 768){ //dml_blmr.widget_wrapper.style.background = "url('https://bioluminc.com/img/pwrbrt_onboarding_bg_desktop.jpg') no-repeat center center"; }else{ //dml_blmr.widget_wrapper.style.background = "url('https://bioluminc.com/img/pwrbrt_onboarding_mobile_bg.jpg') no-repeat center center"; } //dml_blmr.widget_wrapper.style.backgroundSize= "cover"; }else{ var sessionTimeString = (new Date()).getTime(); var cssId = 'blmrStyleSheet'; var pagelink = document.createElement('link'); pagelink.id = cssId; pagelink.rel = 'stylesheet'; pagelink.type = 'text/css'; pagelink.href = 'https://bioluminc.com/css/styles.min.css?'+sessionTimeString; pagelink.media = 'all'; dml_blmr.widget_wrapper.appendChild(pagelink); setTimeout(function(){dml_blmr.sendGA("flow",{action: "loading full script", page_title: "blmr_landing_page", page_location: window.location.hostname, page_path: window.location.pathname});},2000); dml_blmr.getEmbedHtmlData('https://bioluminc.com/widget?'+sessionTimeString, function(res) { dml_blmr.widget_wrapper.innerHTML = res.data + dml_blmr.widget_wrapper.innerHTML; dml_blmr.getScript('https://bioluminc.com/script.js?'+sessionTimeString,function(){}); document.getElementById("blmr_body").style.height=window.innerHeight + "px"; dml_blmr.widget_wrapper.style.height = window.innerHeight + "px"; window.addEventListener('resize',function(){ if (dml_blmr.widget_wrapper.style.height != "auto"){ dml_blmr.widget_wrapper.style.height = window.innerHeight + "px"; document.getElementById("blmr_body").style.height=window.innerHeight + "px"; } }) }) } } dml_blmr.makeBanner = function(){ dml_blmr.openConsentOnWidgetLoad = false; dml_blmr.widget_wrapper.innerHTML = "
" + dml_blmr.widget_wrapper.innerHTML; var bannerEl = document.getElementById("blmr_banner_container"); var sessionTimeString = (new Date()).getTime(); var cssId = 'blmrBannerStyleSheet'; var bannerStyle = document.createElement('link'); bannerStyle.id = cssId; bannerStyle.rel = 'stylesheet'; bannerStyle.type = 'text/css'; bannerStyle.href = 'https://bioluminc.com/css/banner.min.css?'+sessionTimeString; bannerStyle.media = 'all'; bannerEl.appendChild(bannerStyle); var bannerBg1 = document.createElement('div'); bannerBg1.id = "blmr_banner_bg_img_1"; bannerBg1.classList.add('blmr_banner_bg_img'); bannerEl.appendChild(bannerBg1); var bannerBg2 = document.createElement('div'); bannerBg2.id = "blmr_banner_bg_img_2"; bannerBg2.classList.add('blmr_banner_bg_img'); bannerEl.appendChild(bannerBg2); var bannerBg3 = document.createElement('div'); bannerBg3.id = "blmr_banner_bg_img_3"; bannerBg3.classList.add('blmr_banner_bg_img'); bannerEl.appendChild(bannerBg3); var filterDiv = document.createElement('div'); filterDiv.id = "blmr_banner_filter"; bannerEl.appendChild(filterDiv); var bannerContent = document.createElement('div'); bannerContent.id = "blmr_banner_content"; bannerContent.innerHTML += `

${dml_blmr.bannerTexts.title}

${dml_blmr.bannerTexts.cta}

`; bannerContent.innerHTML += `
`; bannerEl.appendChild(bannerContent); var bannerMobileCta = document.createElement('p'); bannerMobileCta.innerHTML += `

${dml_blmr.bannerTexts.cta}

`; bannerEl.appendChild(bannerMobileCta); function updateBannerClassDueWith(){ if (dml_blmr.widget_wrapper.offsetWidth >= 768){ document.getElementById("blmr_banner_container").classList.remove('dml_768'); document.getElementById("blmr_banner_container").style.height = `350px`; }else{ document.getElementById("blmr_banner_container").classList.add('dml_768'); document.getElementById("blmr_banner_container").style.height = `500px`; } } if (dml_blmr.widget_wrapper.offsetWidth < 1){ dmlWrapperDisplayedInterval = setInterval(()=>{ if (dml_blmr.widget_wrapper.offsetWidth > 0){ clearInterval(dmlWrapperDisplayedInterval); updateBannerClassDueWith() } },200) }else{ updateBannerClassDueWith(); } window.addEventListener("resize",updateBannerClassDueWith); } // start app/banner if (dml_blmr.hasBanner){ dml_blmr.makeBanner() }else{ dml_blmr.openApp() }