(function(){ var embedURL = '//content.synapsys.us/embeds/placement.js', domain = (function() { var myHost; try { // Try to get the top host myHost = top.location.host; } catch (e) {} if ( typeof myHost == "undefined" || myHost == "" ) { try { // Get the highest we can find var cWin = window; var i = 0; while ( i++ < 100 && cWin != cWin.top ) { // Check for access to the parent element if ( typeof cWin.parent.document.body == "undefined" ) { throw "Safari Error"; } // Try to go to the parent var temp_body = cWin.parent.document.body; cWin = cWin.parent; } } catch (e) {} // Use the referrer var matches = cWin.document.referrer.match(/^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i); var myHost = matches && matches[1]; // Throw an error if no host if ( typeof myHost == "undefined" || myHost === null ) { throw "Error finding host"; } } myHost = myHost.split('.'); switch (myHost.length) { case 0: //crash me, please case 1: //crash me, please case 2: //exactly what we want return myHost.join('.'); default: // Get the 2 strings to check var last2 = myHost.slice(-2).join('.'); var last3 = myHost.slice(-3).join('.'); if ( ['co.uk', 'com.au', 'go.com'].indexOf(last2) !== -1 || last3 === 'fiostrending.verizon.com' || myHost.slice(-3, -2)[0].indexOf('chatter') !== -1 ) { // Return the last 3 parts of the url // Cases: 3 part domains, verizon, chatter websites return last3; } else { return last2; } } })(), currentScript = document.currentScript || (function() { var scripts = document.getElementsByTagName('script'); for ( var i = scripts.length - 1; i >= 0; i-- ) { if ( scripts[i].src.indexOf(embedURL) != -1 ) { return scripts[i]; } } })(), ig_q = { dom: domain, rand: Math.random() * 1E20 }, query_whitelist = ['adH','adOffX','adOffY','adW','cat','dom','league','mobile','name','p','remn','style','type','widH','widW','county'], query_config = currentScript.src.split('?').length > 1 ? (function(string) { // Split on & var split_string = string.split('&'), query_params = {}, key_split; for ( var i = 0; i < split_string.length; i++ ) { // Get the query params key_split = split_string[i].split('='); // Check the whitelist if ( query_whitelist.indexOf(key_split[0]) !== -1 ) { query_params[key_split[0]] = typeof key_split[1] !== "undefined" ? key_split[1] : ''; } } return query_params; })(currentScript.src.split('?').slice(-1)[0]) : '', newScript = document.createElement('script'); Object.keys(query_config).map(function(key){ ig_q[key] = query_config[key]; }); newScript.src = '//content.synapsys.us/l/n/igloo.php?' + Object.keys(ig_q).map(function(key){return encodeURIComponent(key) + '=' + encodeURIComponent(ig_q[key]);}).join('&'); currentScript.parentNode.insertBefore(newScript, currentScript); })();