(function(d) { // replace with the domain of your site (e.g. parsely.com) var siteName; var domain = document.location.search.split("//")[1].split('/')[0]; switch (true) { case location.hostname == "www.cnbc.com": case location.hostname == "dealornodeal.cnbc.com": case domain == "www.cnbc.com": case domain == "dealornodeal.cnbc.com": siteName = "cnbc.com"; break; case location.hostname == "stg-02deal.cnbc.com": case domain == "stg-02deal.cnbc.com": siteName = "stg-02web.cnbc.com"; break; case (location.hostname.indexOf("qa") != -1 ) && (location.hostname.indexOf("buffett.cnbc.com") != -1): case (location.hostname.indexOf("dev") != -1 ) && (location.hostname.indexOf("buffett.cnbc.com") != -1): case (domain.indexOf("qa") != -1 ) && (domain.indexOf("buffett.cnbc.com") != -1): case (domain.indexOf("dev") != -1 ) && (domain.indexOf("buffett.cnbc.com") != -1): siteName = "sandbox.buffett.cnbc.com"; break; case (location.hostname.indexOf("qa") != -1 ) && (location.hostname.indexOf("acorns.com") != -1): case (location.hostname.indexOf("dev") != -1 ) && (location.hostname.indexOf("acorns.com") != -1): case (domain.indexOf("dev") != -1 ) && (domain.indexOf("acorns.com") != -1): case (domain.indexOf("qa") != -1 ) && (domain.indexOf("acorns.com") != -1): siteName = "sandbox.grow.acorns.com"; break; case (location.hostname.indexOf("qa") != -1 ) && (location.hostname.indexOf("cnbc.com") != -1): case (location.hostname.indexOf("dev") != -1 ) && (location.hostname.indexOf("cnbc.com") != -1): case (domain.indexOf("qa") != -1 ) && (domain.indexOf("cnbc.com") != -1): case (domain.indexOf("dev") != -1 ) && (domain.indexOf("cnbc.com") != -1): siteName = "sandbox.cnbc.com"; break; default: siteName = domain; } if (!window.PARSELY){ window.PARSELY = {autotrack:false, video:{autotrack:false}}; } var site = siteName, b = d.body, e = d.createElement("div"); e.innerHTML = ''; e.id = "parsely-root"; e.style.display = "none"; b.appendChild(e); })(document); (function(s, p, d) { var h=d.location.protocol, i=p+"-"+s, e=d.getElementById(i), r=d.getElementById(p+"-root"), u=h==="https:"?"d1z2jf7jlzjs58.cloudfront.net" :"static."+p+".com"; if (e) return; e = d.createElement(s); e.id = i; e.async = true; e.src = h+"//"+u+"/p.js"; r.appendChild(e); })("script", "parsely", document); (function() { var count = 0; var timer = setInterval(function(){ if(count > 60 || (window.PARSELY && PARSELY.config && PARSELY.config.parsely_site_uuid) ) { clearInterval(timer); profileBeacon(); } count++; }, 1000); function profileBeacon() { var uuid = (window.PARSELY && PARSELY.config && PARSELY.config.parsely_site_uuid) ? PARSELY.config.parsely_site_uuid : null; if (!uuid) {return} var urlArray = window.location.href.split('?'); var url = urlArray[0]; var urlPrams = []; var apikey = "cnbc.com", parsely_base = "https://api.parsely.com/v2/profile?", beacon = new Image(); beacon.src = parsely_base + "apikey=" + apikey + "&url=" + encodeURIComponent(url) + "&uuid=" + uuid; window.PARSELY.config["heartbeat_should_honor_autotrack"]=true; window.PARSELY.onload = function(){PARSELY.updateDefaults({ampid:'{"id":"' + PARSELY.config.uuid + '"}'})}; console.log('PARSELY IS HERE', PARSELY); }; })(); var fnVideoStart_CNBCparsely = fnVideoStart_CNBCparsely || function(data) { try { if (window.PARSELY) { _clipData = data; window.setTimeout(function() { PARSELY.video.trackPauseAll(); var clipId; clipId = data.vcpsId; var tagArray1 = []; if (data.sectionHierarchy.length !== 0) {data.sectionHierarchy.forEach(function(arrayItem) { tagArray1.push(arrayItem.tagName); });}; if (data.additionalSectionContent.length !== 0) {data.additionalSectionContent.forEach(function(arrayItem) { tagArray1.push(arrayItem.tagName); });}; if (data.relatedTags.length !== 0) {data.relatedTags.forEach(function(arrayItem) { tagArray1.push(arrayItem.tagName); });}; if (data.brand) {tagArray1.push(data.brand)}; if (data.premium && data.premium != false) {tagArray1.push("Premium")}; if (data.premium && data.native != false) {tagArray1.push("Sponsored")}; var tagArray2 = new Set(tagArray1); var tagArray3 = [...tagArray2]; var authorArray = []; if (data.creatorOverwrite) { authorArray.push(data.creatorOverwrite); console.log("Parsely: Author = creatorOverwrite"); } else if (data.author.length !== 0) { data.author.forEach(function(arrayItem) {authorArray.push(arrayItem.name);}); console.log("Parsely: Author = author"); } else { data.sourceOrganization.forEach(function(arrayItem) {authorArray.push(arrayItem.tagName);}); console.log("Parsely: Author = sourceOrganization"); } var videoUrl = location.search.split("=")[2]; console.log("videoUrl", videoUrl); PARSELY.video.trackPlay( clipId, { // required title: (data.title != undefined) ? data.title : "NA", // recommended section: (data.sectionHierarchy.length == 0) ? "" : data.sectionHierarchy[0].tagName, pub_date_tmsp: (data.datePublished != undefined) ? (Date.parse(data.datePublished.replace(/\+0000/g,"Z"))) : "", image_url: (data.image != undefined) ? data.image.url : "", duration: (data.duration != undefined) ? (data.duration*1000) : "", // optional tags: tagArray3, authors: authorArray }, videoUrl ); }, 1000); } console.log("Parsely: videoStart v3"); } catch(error) { console.log("Parsely: Video Event Analytics are not working ! Some external plugin might be blocking it !!"); } } window.__EventBus__.remove("videoStart", fnVideoStart_CNBCparsely); window.__EventBus__.on("videoStart", fnVideoStart_CNBCparsely); var fnVideoPause_CNBCparsely = fnVideoPause_CNBCparsely || function(data) { try { if (window.PARSELY) { PARSELY.video.trackPauseAll(); } console.log("Parsely: videoPause"); } catch(error) { console.log("Parsely: Video Event Analytics are not working ! Some external plugin might be blocking it !!"); } } window.__EventBus__.remove("videoPause", fnVideoPause_CNBCparsely); window.__EventBus__.on("videoPause", fnVideoPause_CNBCparsely); var fnVideoComplete_CNBCparsely = fnVideoComplete_CNBCparsely || function(data) { try { if (window.PARSELY) { PARSELY.video.trackPauseAll(); } console.log("Parsely: videoComplete"); } catch(error) { console.log("Parsely: Video Event Analytics are not working ! Some external plugin might be blocking it !!"); } } window.__EventBus__.remove("videoComplete", fnVideoComplete_CNBCparsely); window.__EventBus__.on("videoComplete", fnVideoComplete_CNBCparsely); console.log("**** LOADED: Parsely: Video Event Tracking");