/* B3/XPN_Wrapper_US_IAS - 20430803 - 2015-02-14 */ tbVersion = '1.2.5'; function tfsa_get_url() { try { window.parentIsPermitted = false; window.ASCurWin = window; try { for (i = 0; i <= 10; i++) { if ((window.ASCurWin.parent != null) && (window.ASCurWin.parent != window.ASCurWin)) { var loc = window.ASCurWin.parent.location.toString(); var x = loc.length; if (x > 0) { window.ASCurWin = window.ASCurWin.parent; window.parentIsPermitted = true; } else { window.parentIsPermitted = false; break; } } else { if (i == 0) { window.parentIsPermitted = true; } break; } } } catch (e) { window.parentIsPermitted = false; } if (window.ASCurWin.document.referrer.length == 0) { window.ASurl = window.ASCurWin.location; } else { if (window.parentIsPermitted) { window.ASurl = window.ASCurWin.location; } else { window.ASurl = window.ASCurWin.document.referrer; } } var oas_referer=ASurl; return oas_referer; } catch (ex) { } } function URLparser(str) { var o = URLparser.options, m = o.parser["loose"].exec(str), uri = {}, i = 14; while (i--) uri[o.key[i]] = m[i] || ""; uri[o.q.name] = {}; uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) { if ($1) uri[o.q.name][$1] = $2; }); return uri; } URLparser.options = { key: ["source", "protocol", "authority", "userInfo", "user", "password", "host", "port", "relative", "path", "directory", "file", "query", "anchor"], q: { name: "queryKey", parser: /(?:^|&)([^&=]*)=?([^&]*)/g }, parser: { loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ } } function tbLoad(crtData, initFunctions) { cData = crtData.split('|'); for (i = 0; i < cData.length; i++) { switch (i) { case 0 : impCamp = cData[i]; break; case 1 : impCrt = cData[i]; break; case 2 : impPage = cData[i]; break; case 3 : impPos = cData[i]; break; } } if (isInDebug) { console.info('Thunder Bolt Functions Loaded -- Campaign : ' + impCamp + ' Creative : ' + impCrt); } } function tbLogger() { tfsa_query = ''; tfsa_query_log = tfsa_query.replace(/&&/g, '&'); tfsa_query_log = (tfsa_query_log.indexOf('&') == 0) ? tfsa_query_log.substring(1) : tfsa_query_log; tfsa_query_log = (tfsa_query_log.lastIndexOf('&') == (tfsa_query_log.length - 1)) ? tfsa_query_log.substring(0, (tfsa_query_log.length - 1)) : tfsa_query_log; tfsa_query_log = tfsa_query_log.replace(/&/g, ')AND('); console.info('Thunder Bolt Debug Information -- Version : ' + tbVersion + ' -- Thunder Bolt loaded ' + (isInIFrame ? 'in iFrame' : 'on page') + ' - B3/XPN_Wrapper_US_IAS : 20430803 ' + '\n Ad Tag URL : ' + x_tag.sx_url + '\n Page URL : ' + tfsa_URL + '\n Page Referrer : ' + tfsa_Ref + '\n Search Terms - ((' + tfsa_query_log + '))' + '\n Referral Type : ' + ((refType != '') ? refType : 'Empty') + '\n Referral Engine : ' + ((refEngine != '') ? refEngine : 'Empty') ); } refType = ''; refEngine = ''; tfsa_click = unescape(unescape(tfsa_click)); tfsa_click = '_RM_HTML_CLICK_=' + ((tfsa_click.match(/^(http|https)/i) != null) ? escape(tfsa_click) : ''); /* Set Pub Click URL */ tfsa_pb_string = '&_RM_HTML_PTAG_=' + (((typeof tfsa_pb != undefined) && (typeof tfsa_pb != 'undefined') && (tfsa_pb.match(/^(http|https)/i) != null)) ? escape(escape(tfsa_pb)) : ''); tfsa_pb_string += '&_RM_HTML_PTYPE_=' + (((typeof tfsa_pbt != undefined) && (typeof tfsa_pbt != 'undefined') && ((tfsa_pbt == 'i') || (tfsa_pbt == 'j'))) ? tfsa_pbt : ''); if ((typeof tfsa_terms != undefined) && (typeof tfsa_terms != 'undefined') && (tfsa_terms != '')) { tfsa_query += '&' + tfsa_terms; }; tfsa_pub_site = (tfsa_pub.indexOf('/') != -1) ? tfsa_pub.substring(0, tfsa_pub.indexOf('/')) : tfsa_pub; isInIFrame = (window.location != window.parent.location) ? true : false; tfsa_URL = tfsa_get_url(); tfsa_Ref = (!isInIFrame) ? parent.document.referrer : ''; tfsa_iFrame_URL = (isInIFrame) ? document.location.href : ''; debugCookie = ''; isInDebug = ((URLparser(tfsa_URL).queryKey.tbDebug == 'y') || (debugCookie != '')) ? true : false; tfsa_protocol = (URLparser(tfsa_URL).protocol == 'https') ? 'https://' : 'http://'; tfsa_host = URLparser(tfsa_URL).host.toLowerCase(); if (tfsa_host == '') { tfsa_host = 'unknown_site'; } else { hostParts = tfsa_host.split('.'); if (hostParts[0] == 'www') { tfsa_host = tfsa_host.substring(4); } if (tfsa_host.lastIndexOf('.') == (tfsa_host.length - 1)) { tfsa_host = tfsa_host.substring(0, (tfsa_host.length - 1)) } if (tfsa_host.indexOf('.') != 0) { tfsa_host = '.' + tfsa_host; } } if (tfsa_Ref != '') { tfsa_Ref_host = URLparser(tfsa_Ref).host.toLowerCase(); if (URLparser(tfsa_Ref).host != URLparser(tfsa_URL).host) { if (tfsa_Ref_host.indexOf('google.') != -1) { refEngine = 'google'; refType = 'search'; } else if (tfsa_Ref_host.indexOf('bing.') != -1) { refEngine = 'bing'; refType = 'search'; } else if (tfsa_Ref_host.indexOf('yahoo.') != -1) { refEngine = 'yahoo'; refType = 'search'; } else if (tfsa_Ref_host.indexOf('ask.') != -1) { refEngine = 'ask'; refType = 'search'; } else if (tfsa_Ref_host.indexOf('aol.') != -1) { refEngine = 'aol'; refType = 'search'; } else if (tfsa_Ref_host.indexOf('facebook.') != -1) { refEngine = 'facebook'; refType = 'social'; } else if ((tfsa_Ref_host.indexOf('twitter.') != -1) || (tfsa_Ref.indexOf('/t.co/') != -1)) { refEngine = 'twitter'; refType = 'social'; } else if (tfsa_Ref_host.indexOf('youtube.') != -1) { refEngine = 'youtube'; refType = 'social'; } else if (tfsa_Ref_host.indexOf('pinterest.') != -1) { refEngine = 'pinterest'; refType = 'social'; } else if (tfsa_Ref_host.indexOf('reddit.') != -1) { refEngine = 'reddit'; refType = 'social'; } else if (tfsa_Ref_host.indexOf('tumblr.') != -1) { refEngine = 'tumblr'; refType = 'social'; } else if (tfsa_Ref_host.indexOf('walmart.') != -1) { refEngine = 'walmart'; refType = 'retail'; } else if (tfsa_Ref_host.indexOf('.target.') != -1) { refEngine = 'target'; refType = 'retail'; } else if (tfsa_Ref_host.indexOf('.buy.') != -1) { refEngine = 'buy'; refType = 'retail'; } else if (tfsa_Ref_host.indexOf('.amazon.') != -1) { refEngine = 'amazon'; refType = 'retail'; } else if (tfsa_Ref_host.indexOf('.ebay.') != -1) { refEngine = 'ebay'; refType = 'retail'; } else if ((tfsa_Ref_host.indexOf('.overstock.') != -1) || (tfsa_Ref_host.indexOf('.o.co') != -1)) { refEngine = 'overstock'; refType = 'retail'; } else { refEngine = tfsa_Ref_host; refType = 'organic'; } //'&migParam2=' + refType + ':' + refEngine + ':' + tfsa_Ref + '&migParam3=&migParam4=&migParam5='; } else { refEngine = tfsa_Ref_host; refType = 'internal'; } } else { refEngine = 'direct'; refType = isInIFrame ? 'unknown' : 'direct'; } var x_tag = {}; x_tag.appendScript = function (elementID, scriptID, scriptURL) { try { newScript = document.createElement('script'); newScript.type = 'text/javascript'; newScript.id = scriptID + '_941043301'; newScript.src = scriptURL; appendElement = document.getElementById(elementID); appendElement.appendChild(newScript); if (isInDebug) { console.info('Script Loaded from TB: ID - ' + scriptID + '\n URL - ' + scriptURL); } } catch (e) { if (isInDebug) { console.error('Script Not Loaded from TB: ID - ' + scriptID + '\n URL - ' + scriptURL + '\n Error - ' + e); } } } x_tag.appendIframe = function (elementID, iFrameID, iFrameURL) { try { newIframe = document.createElement('iframe'); newIframe.setAttribute('id', iFrameID + '_941043301'); newIframe.setAttribute('style', 'display:none'); newIframe.style.cssText = 'display:none'; newIframe.src = iFrameURL; appendElement = document.getElementById(elementID); appendElement.appendChild(newIframe); if (isInDebug) { console.info('iFrame Loaded from TB: ID - ' + iFrameID + '\n URL - ' + iFrameURL); } } catch (e) { if (isInDebug) { console.error('iFrame Not Loaded from TB: ID - ' + iFrameID + '\n URL - ' + iFrameURL + '\n Error - ' + e); } } } x_tag.appendPixel = function (elementID, pixelID, pixelURL) { try { newPixel = new Image(1, 1); newPixel.src = pixelURL; newPixel.id = pixelID; appendElement = document.getElementById(elementID); appendElement.appendChild(newPixel); if (isInDebug) { console.info('Pixel Loaded from TB: ID - ' + pixelID + '\n URL - ' + pixelURL)} } catch (e) { if (isInDebug) { console.error('Pixel Not Loaded from TB: ID - ' + pixelID + '\n URL - ' + pixelURL + '\n Error - ' + e); } } } x_tag.appendAD = function (pos, url, elementID) { posH = x_tag.getPosSize(pos).h + 'px'; posW = x_tag.getPosSize(pos).w + 'px'; try { newIframe = document.createElement('iframe'); newIframe.setAttribute('id', 'XM_' + pos + '_iframe_941043301'); newIframe.setAttribute('height', posH); newIframe.setAttribute('width', posW); newIframe.setAttribute('marginheight', 0); newIframe.setAttribute('marginwidth', 0); newIframe.setAttribute('frameborder', 0); newIframe.setAttribute('scrolling', 'no'); newIframe.setAttribute('style', 'width:' + posW + '; height:' + posH + '; border:0; margin:0; padding:0'); newIframe.style.cssText = 'width:' + posW + '; height:' + posH + '; border:0; margin:0; padding:0'; newIframe.src = url; appendElement = document.getElementById(elementID); appendElement.appendChild(newIframe); if (isInDebug) { console.info('Ad Tag Loaded from TB: Position - ' + pos + '\n URL - ' + url)} } catch (e) { if (isInDebug) { console.error('Ad Tag Not Loaded from TB: Position - ' + pos + '\n URL - ' + url + '\n Error - ' + e); } } } x_tag.getPosSize = function (pos) { switch (pos) { case 'Position1': posSize = { w: '468', h: '60' }; break; case 'Top1': posSize = { w: '728', h: '90' }; break; case 'x01': posSize = { w: '234', h: '60' }; break; case 'x08': posSize = { w: '120', h: '600' }; break; case 'x10': posSize = { w: '160', h: '600' }; break; case 'x14': posSize = { w: '180', h: '150' }; break; case 'x15': posSize = { w: '300', h: '250' }; break; case 'x16': posSize = { w: '300', h: '600' }; break; case 'x50': posSize = { w: '120', h: '20' }; break; case 'x51': posSize = { w: '120', h: '30' }; break; case 'x52': posSize = { w: '168', h: '28' }; break; case 'x53': posSize = { w: '168', h: '42' }; break; case 'x54': posSize = { w: '216', h: '36' }; break; case 'x55': posSize = { w: '216', h: '54' }; break; case 'x56': posSize = { w: '300', h: '50' }; break; case 'x57': posSize = { w: '300', h: '75' }; break; case 'x58': posSize = { w: '320', h: '50' }; break; case 'x59': posSize = { w: '300', h: '250' }; break; case 'x60': posSize = { w: '970', h: '250' }; break; case 'x61': posSize = { w: '970', h: '90' }; break; case 'x62': posSize = { w: '300', h: '600' }; break; case 'x63': posSize = { w: '970', h: '90' }; break; case 'x64': posSize = { w: '300', h: '1050' }; break; default: posSize = { w: '1', h: '1' }; } return posSize; } x_tag.formatRating = function (rating) { switch (rating) { case 'low risk': fRating ='LowRisk'; break; case 'moderate risk': fRating ='ModerateRisk'; break; case 'high risk': fRating ='HighRisk'; break; case 'very high risk': fRating ='VeryHighRisk'; break; default: fRating ='Unknown'; } return fRating; } x_tag.pTrackers = function (pos, elementID) { /* Moat */ x_tag.appendScript(elementID, 'XM_MOAT_' + pos + '_941043301', tfsa_protocol + 'js.moatads.com/oas32jfnz992/moatad.js#moatClientLevel1=ThunderBolt&moatClientLevel2=' + tbVersion + '&moatClientLevel3=&moatClientLevel4=&moatClientSlicer1=' + pos + '&moatClientSlicer2=' + tfsa_pub + '&moatClientSlicer3=' + tfsa_host + '&moatClientSlicer4=&psd=1'); /* ComScore */ var _comscore = _comscore || []; _comscore.push({ c1: "8", c2: "13846818", c3: "2014060100000000001" }); x_tag.appendScript(elementID, 'XM_ComScore_' + pos + '_941043301', (document.location.protocol == 'https:' ? 'https://sb' : 'http://b') + '.scorecardresearch.com/beacon.js'); } x_tag.sTrackers = function (pos, elementID) { /* Data Management */ x_tag.appendIframe(elementID, 'XM_Data_' + pos + '_941043301', tfsa_protocol + 'dm.de.mookie1.com/2/B3DM/2010DM/' + tfsa_pub_site + '/941043301@x23?B3/XPN_Wrapper_US_IAS/' + pos); /* WhiteOps */ x_tag.appendScript(elementID, 'XM_WhiteOps_' + pos + '_941043301', tfsa_protocol + 't.mookie1.com/rsp?dnv=941043301&min_age=1&rurl=http://s.adnxtr.com/2/875701/pagespeed.js?ac=B3/XPN_Wrapper_US_IAS%26si=' + tfsa_pub_site + '%26pi=' + tfsa_pub + '%26cr=20430803%26cb=941043301%26dm=' + x_tag.getPosSize(pos).w + 'x' + x_tag.getPosSize(pos).h + '%26ui=[MOOKIE]%26dt=8757011423579412859017'); /* Mookie Trackers */ mookie_action = tfsa_protocol + 't.mookie1.com/t/v1/event?migClientId=4056&migAction=tfsa&migSource=mig&migRandom=941043301&migParam1=' + tfsa_pub + '&migParam2=' + tfsa_pos + '&migParam3=' + tfsa_host; tagR_imp = tfsa_protocol + 'gmtdmp.mookie1.com/tagr/v1/imp?acid=2&inst=NA&zeus.migAgencyId=399&zeus.migSource=b3&zeus.migRandom=941043301&zeus.migTrackDataExt=n1;USNetwork/track_targeting;reporting;:$:' + tfsa_pub_site + ':$:&zeus.migTrackFmtExt=network;account/campaign;ad;page&src.domain=' + URLparser(tfsa_URL).host + '&src.url=' + URLparser(tfsa_URL).relative; tagR_learn = tfsa_protocol + 'gmtdmp.mookie1.com/tagr/v1/learn?acid=2&inst=NA&tagid=449819041&src.rand=941043301&src.id=USmarketplace&src.domain=' + URLparser(tfsa_URL).host + '&src.url=' + URLparser(tfsa_URL).relative; //tagR_learn = tfsa_protocol + 'gmtdmp.mookie1.com/t/v2/learn?tagid=72&src.rand=941043301&src.domain=' + URLparser(tfsa_URL).host + '&src.url=' + URLparser(tfsa_URL).relative x_tag.appendPixel(elementID, 'XM_tagR_imp_' + pos + '_941043301', tagR_imp); x_tag.appendPixel(elementID, 'XM_mookie_' + pos + '_941043301', mookie_action); x_tag.appendPixel(elementID, 'XM_tagR_learn_' + pos + '_941043301', tagR_learn); } x_tag.getIASCallbacksFor = function (pubID, pos) { x_tag.element = 'TFSA_' + pos; return { api: function (integralApiData) { x_tag.sx_url = tfsa_protocol + 'network.realmedia.com/2/' + pubID + '/941043301@' + pos + '?'; x_tag.sx_url += 'impSite=' + tfsa_host + '&_RM_HTML_SITE_=' + ((tfsa_host.indexOf('.') == 0) ? tfsa_host.substring(1) : tfsa_host); x_tag.sx_url += '&lang=' + ((navigator.language) ? navigator.language.toLowerCase() : navigator.userLanguage.toLowerCase()) + '&refType=' + refType + '&refEngine=' + refEngine; /* Append IAS Content Data */ x_tag.sx_url += '&ias_rsa=' + integralApiData.rsa + '&ias_vio=' + x_tag.formatRating(integralApiData.risk.vio) + '&ias_drg=' + x_tag.formatRating(integralApiData.risk.drg) + '&ias_alc=' + x_tag.formatRating(integralApiData.risk.alc) + '&ias_off=' + x_tag.formatRating(integralApiData.risk.off) + '&ias_dim=' + x_tag.formatRating(integralApiData.risk.dlm) + '&ias_adt=' + x_tag.formatRating(integralApiData.risk.adt) + '&ias_hat=' + x_tag.formatRating(integralApiData.risk.hat); /* Append IAS Viewability Data */ x_tag.sx_url += ''; /* Append Publisher Tracking Strings */ x_tag.sx_url += tfsa_click + tfsa_pb_string; /* Inject Ad Tag */ x_tag.appendAD(pos, x_tag.sx_url, x_tag.element); if (integralApiData.rsa == 1000) { x_tag.sTrackers(pos, x_tag.element); } mookie_action = tfsa_protocol + 't.mookie1.com/t/v1/event?migClientId=4056&migAction=xm-ias-auditable&migSource=mig&migRandom=941043301&migParam1=' + tfsa_pub + '&migParam2=' + tfsa_pos + '&migParam3=' + tfsa_host; }, viewable: function () { mookie_action = tfsa_protocol + 't.mookie1.com/t/v1/event?migClientId=4056&migAction=xm-ias-viewable&migSource=mig&migRandom=941043301&migParam1=' + tfsa_pub + '&migParam2=' + tfsa_pos + '&migParam3=' + tfsa_host; if (isInDebug) { console.log(pubID + ' @ ' + pos + ' is viewable'); } }, measurable: function () { mookie_action = tfsa_protocol + 't.mookie1.com/t/v1/event?migClientId=4056&migAction=xm-ias-measurable&migSource=mig&migRandom=941043301&migParam1=' + tfsa_pub + '&migParam2=' + tfsa_pos + '&migParam3=' + tfsa_host; if (isInDebug) { console.log(pubID + ' @ ' + pos + ' is measurable'); } } }; }; x_tag.load = function (pos, pub) { x_tag.ias_callbacks = x_tag.getIASCallbacksFor(pub, pos); var __IntegralASConfig = { onMeasurable: x_tag.ias_callbacks.measurable, onInViewMRC: x_tag.ias_callbacks.viewable, onAPIResult: x_tag.ias_callbacks.api }; iasURL = tfsa_protocol + '7453.bapi.adsafeprotected.com/bapi?anId=7453&chanID=' + pos + '&placementId=B3/XPN_Wrapper_US_IAS&advId=MarketPlace&pubId=' + pub + '&planId=' + x_tag.getPosSize(tfsa_pos).w + 'x' + x_tag.getPosSize(tfsa_pos).h; x_tag.appendScript('TFSA_' + pos, 'XM_IAS_' + pos + '_941043301', iasURL); /* Load Pre Scan Trackers */ x_tag.pTrackers(pos, 'TFSA_' + pos); /* Load Logger */ if (isInDebug) { tbLogger(); } } x_tag.ias_callbacks = x_tag.getIASCallbacksFor(tfsa_pub_site, tfsa_pos); var __IntegralASConfig = { onMeasurable: x_tag.ias_callbacks.measurable, onInViewMRC: x_tag.ias_callbacks.viewable, onAPIResult: x_tag.ias_callbacks.api }; iasURL = tfsa_protocol + '7453.bapi.adsafeprotected.com/bapi?anId=7453&chanID=' + tfsa_pos + '&placementId=B3/XPN_Wrapper_US_IAS&advId=MarketPlace&pubId=' + tfsa_pub_site + '&planId=' + x_tag.getPosSize(tfsa_pos).w + 'x' + x_tag.getPosSize(tfsa_pos).h; document.write('