
/* Controltag Loader for NBCUniversal */
(function(){
  var debugging = /kxdebug/.test(location);
  var log = function() {
    // It's a flag, so if it's there, then it means debug.
    debugging && window.console && console.log([].slice.call(arguments).join(' '));
  };

  var load = function(url, callback) {
    log('Loading script from:', url);
    var node = document.createElement('script');
    node.async = true;  // This is just to be friendly.
    node.src = url;

    // Connect to both in case we're in older IE.
    node.onload = node.onreadystatechange = function() {
      var state = node.readyState;
      if (!callback.done && (!state || /loaded|complete/.test(state))) {
        log('Script loaded from:', url);
        callback.done = true;  // Mark the callback, so we don't load it twice on accident.
        callback();
      }
    };

    // Fetch the first script element, so we can insert the
    // controltag before it. There *must* be at least one
    // script element, or this code would never be called
    var sibling = document.getElementsByTagName('script')[0];
    sibling.parentNode.insertBefore(node, sibling);
  };

  // ControlTag simply crashes when opening a website from Twitter browser on
  // iOS, temporarily disable CT when Twitter for iPhone is detected until they
  // fix this (works fine with other twitter client though)
  if (/Twitter for iPhone/.test(window.navigator.userAgent || '')) return;

  var config = {"partner_segment_map": {}, "context_terms": [{"id": "JU5lk0Wm", "value": "Premier League"}, {"id": "JVEEuygn", "value": "Manchester United"}, {"id": "JVEEuyop", "value": "Manchester City"}, {"id": "JVEEuywy", "value": "Aston Villa"}, {"id": "JVEEuy57", "value": "EPL"}, {"id": "JVEEuzCf", "value": "West Ham"}, {"id": "JVEEuzK3", "value": "English Premier League"}, {"id": "JVEEuzS8", "value": "Barclays Premier League"}, {"id": "JVEEuzaz", "value": "Fulham"}, {"id": "JVEEuzio", "value": "Tottenham"}, {"id": "JVEEuzqd", "value": "Arsenal"}, {"id": "JVEEuzym", "value": "FA Cup"}, {"id": "JVEEuz9b", "value": "Carling Cup"}, {"id": "JVZ0lz3Q", "value": "Danny Welbeck"}, {"id": "JVZ0lz--", "value": "Joe Hart"}, {"id": "JVZ0l0G9", "value": "Mario Balotelli"}, {"id": "JVZ0l0Od", "value": "Daniel Sturridge"}, {"id": "JVZ0l0V3", "value": "Rickie Lambert"}, {"id": "JVZ0l0dV", "value": "Swansea City"}, {"id": "JVZ0l0lY", "value": "Hull City"}, {"id": "JVZ0l0s1", "value": "Stoke City"}, {"id": "JVZ0l00i", "value": "Queens Park"}, {"id": "JVZ0l08J", "value": "Sunderland"}, {"id": "JVZ0l1Dx", "value": "Leicester City"}, {"id": "JVZ0l1LT", "value": "Newcastle United"}, {"id": "JVZ0l1TA", "value": "Everton"}, {"id": "JVZ0l1aq", "value": "West Bromwich"}, {"id": "JVZ0l1iO", "value": "Crystal Palace"}, {"id": "JVZ0l1p2", "value": "Burnley"}, {"id": "JVZ0l1xn", "value": "Diego Costa"}, {"id": "JVZ0l15K", "value": "Javi Manquillo"}, {"id": "JVZ0l2Au", "value": "Nathan Dyer"}, {"id": "JVZ0l2IM", "value": "Steven Naismith"}, {"id": "JVZ0l2P4", "value": "Enner Valencia"}, {"id": "JVZ0l2Xe", "value": "Matty James"}, {"id": "JVZ0l2fN", "value": "Welbeck"}, {"id": "JVZ0l2m0", "value": "Balotelli"}, {"id": "JVZ0l2uk", "value": "Fabianski"}, {"id": "JVZ0l22X", "value": "Lukasz Fabianski"}, {"id": "JVZ0l2-E", "value": "Premiership"}, {"id": "JqSNAIdZ", "value": "job"}, {"id": "JqSNAIyQ", "value": "jobs"}, {"id": "JqSNAJGj", "value": "career"}, {"id": "JqSNAJac", "value": "careers"}, {"id": "JqSNAJuP", "value": "sports job"}, {"id": "JqSNAKCA", "value": "sports jobs"}, {"id": "JqSNAKV8", "value": "work"}, {"id": "J5_hJRlR", "value": "matt damon"}, {"id": "J5_hJS3j", "value": "ben affleck"}, {"id": "J5_hJjEx", "value": "good will hunting"}, {"id": "J5_ifsRx", "value": "dogma"}, {"id": "J5_ift_n", "value": "chasing amy"}, {"id": "KAKD_y98", "value": "amy schumer"}, {"id": "KBCXlMT8", "value": "Bobby Cannavale"}, {"id": "KBCXlM8U", "value": "Olivia Wilde"}, {"id": "KBCXlNg_", "value": "Ray Romano"}, {"id": "KBCXlONj", "value": "Ato Essandoh"}, {"id": "KBCXlO_o", "value": "Max Casella"}, {"id": "KGt0Vb9-", "value": "Easy meals"}, {"id": "KGt0VcTC", "value": "15 minute meals"}, {"id": "KGt0Vcnr", "value": "30 minute meals"}, {"id": "KGt0Vc8W", "value": "DIY"}, {"id": "KGt0VdQ5", "value": "Recipes"}, {"id": "KGt0Vdkh", "value": "Family meals"}, {"id": "KGt0Vd4N", "value": "Meal Preparation"}, {"id": "KGt0VeMd", "value": "Meal Prep"}, {"id": "KGt0VegQ", "value": "Party Solutions"}, {"id": "KGt0Ve1B", "value": "Home Meals"}, {"id": "KGt0VfJE", "value": "Cooking"}, {"id": "KGt0Vfc2", "value": "Home Cooking"}, {"id": "KGt0VfwV", "value": "Quick Meals"}, {"id": "KGt0VgEQ", "value": "Quick Dinners"}], "tags": [{"content": "<script>\r\n(function(){\r\n     var kuid = Krux('get', 'user');\r\n     if (kuid) {\r\n         var prefix = 'https:';\r\n         var r_url = prefix + '//tacoda.at.atwola.com/atx/sync/uskrux/uskrx/'\r\n         var kurl = r_url + kuid;\r\n         var i = new Image();\r\n         i.src = kurl;\r\n     }\r\n})();\r\n</script>", "target": "", "target_action": null, "require": "", "docwrite": null, "template_replacement": 1, "execution_results": null, "tier": 1, "internal": 1, "content_type": "html", "timing": "asap", "method": "document", "type": "publisher", "id": 87863, "name": "Krux AOL User Match"}, {"content": "<script>\r\n(function()\r\n{ var i = new Image(); i.src = '//match.adsrvr.org/track/cmf/generic?ttd_pid=krux&ttd_tpi=1'; }\r\n)();\r\n</script>", "target": "", "target_action": null, "require": "", "docwrite": null, "template_replacement": 1, "execution_results": null, "tier": 1, "internal": 1, "content_type": "html", "freq_cap": 3, "timing": "asap", "method": "document", "type": "publisher", "id": 85716, "name": "The Trade Desk User Match"}, {"content": "", "target": null, "target_action": "append", "require": "", "docwrite": null, "template_replacement": 1, "execution_results": null, "tier": 1, "internal": 221, "content_type": "html", "freq_cap": 3, "timing": "onload", "method": "document", "id": 87320, "name": "Nielsen NBCU NCS (via eXelate) provider tag"}, {"content": "<script>\r\n// tag intentionally blank\r\n</script>", "target": null, "target_action": "append", "require": "", "docwrite": null, "template_replacement": 1, "execution_results": null, "tier": 1, "internal": 39, "content_type": "html", "freq_cap": 3, "timing": "onload", "method": "document", "type": "data provider", "id": 27697, "name": "HealthyOffers - NBCU (via LiveRamp) provider tag"}, {"content": "", "target": null, "target_action": "append", "require": "", "docwrite": null, "template_replacement": 1, "execution_results": null, "tier": 1, "internal": 72, "content_type": "html", "freq_cap": 3, "timing": "onload", "method": "document", "id": 45116, "name": "Proximic provider tag"}, {"content": "<script>\r\n// this tag is intentionally blank\r\n</script>", "target": null, "target_action": "append", "require": "", "docwrite": null, "template_replacement": 1, "execution_results": null, "tier": 1, "internal": 6, "content_type": "html", "timing": "onload", "method": "document", "type": "data provider", "id": 11327, "name": "Technographic Data provider tag"}, {"content": "", "target": null, "target_action": "append", "require": "", "docwrite": null, "template_replacement": 1, "execution_results": null, "tier": 1, "internal": 13, "content_type": "html", "freq_cap": 3, "timing": "onload", "method": "document", "id": 16002, "name": "Quantcast provider tag"}, {"content": "", "target": null, "target_action": "append", "require": "", "docwrite": null, "template_replacement": 1, "execution_results": null, "tier": 1, "internal": 215, "content_type": "html", "freq_cap": 3, "timing": "onload", "method": "document", "id": 86461, "name": "Crossix Private (Approval Needed) provider tag"}, {"content": "<script>\r\n    // Empty by design.\r\n</script>\r\n", "target": null, "target_action": "append", "require": "", "docwrite": null, "template_replacement": 1, "execution_results": null, "tier": 1, "internal": 27, "content_type": "html", "freq_cap": 3, "timing": "onload", "method": "document", "type": "data provider", "id": 85185, "name": "IXI Digital (Network) provider tag"}, {"content": "<script>\r\n(function(){\r\n    var prefix = window.location.protocol == 'https:' ? 'https:' : 'http:';\r\n    new Image().src = prefix + '//kr.ixiaa.com/C726AB29-0470-440B-B8D2-D552CED3A3DC/a.gif';\r\n})();\r\n</script>", "target": null, "target_action": "append", "require": "", "docwrite": null, "template_replacement": 1, "execution_results": null, "tier": 1, "internal": 28, "content_type": "html", "freq_cap": 3, "timing": "onload", "method": "document", "type": "data provider", "id": 85186, "name": "IXI Digital Open Market provider tag"}, {"content": "", "target": null, "target_action": "append", "require": "", "docwrite": null, "template_replacement": 1, "execution_results": null, "tier": 1, "internal": 14, "content_type": "html", "freq_cap": 3, "timing": "onload", "method": "document", "id": 23254, "name": "Krux Geographic Data provider tag"}, {"content": "<script>\r\n\r\n(function() {\r\n    (new Image()).src = \"//apiservices.krxd.net/um?partner=vdna&r=\" + window.location.protocol + \"//e.visualdna.com/conversion&_kdpid=8f95f20d-4acf-43fc-9832-3f5174a166cc\";\r\n})();\r\n\r\n</script>", "target": null, "target_action": "append", "require": "", "docwrite": null, "template_replacement": 1, "execution_results": null, "tier": 1, "internal": 12, "content_type": "html", "freq_cap": 3, "timing": "onload", "method": "document", "type": "data provider", "id": 63191, "name": "Visual DNA provider tag"}, {"content": "<script>\r\n// Blank\r\n</script>", "target": null, "target_action": "append", "require": "", "docwrite": null, "template_replacement": 1, "execution_results": null, "tier": 1, "internal": 19, "content_type": "html", "freq_cap": 3, "timing": "onload", "method": "document", "type": "data provider", "id": 14072, "name": "Nielsen (via Exelate) provider tag"}, {"content": "<script>\r\n(function() {\r\n    if (window.location.protocol == 'http:') {\r\n        var img = new Image();\r\n        img.src = \"//bea4.v.fwmrm.net/ad/u?mode=echo&cr=http%3A%2F%2Fbeacon.krxd.net%2Fusermatch.gif%3Fpartner%3Dfreewheel%26partner_uid%3D%23%7Buser.id%7D\"\r\n        img.setAttribute(\"style\", \"width:0px; height:0px; visibility:hidden;\");\r\n        document.body.appendChild(img);\r\n    }\r\n})();\r\n</script>", "target": "", "target_action": null, "require": "", "docwrite": null, "template_replacement": 1, "execution_results": null, "tier": 1, "internal": 1, "content_type": "html", "freq_cap": 3, "timing": "onload", "method": "document", "type": "publisher", "id": 85298, "name": "Freewheel User Match SITE VISIT"}, {"content": "<script>\r\n(function(){\r\n        var kuid = Krux('get', 'user');\r\n        var prefix = window.location.protocol == 'https:' ? 'https:' : 'http:';\r\n        if (kuid) {\r\n           var url = prefix + '//geo-um.btrll.com/v1/map_pixel/partner/48.png';\r\n           (new Image()).src = url;\r\n        }\r\n})();\r\n</script>", "target": "", "target_action": null, "require": "", "docwrite": null, "template_replacement": 1, "execution_results": null, "tier": 1, "internal": 1, "content_type": "html", "freq_cap": 1, "timing": "onload", "method": "document", "type": "publisher", "id": 88161, "name": "Krux BrightRoll User Match"}, {"content": "<script>\r\n(function(){\r\n    var kuid = Krux('get', 'user');\r\n        if (kuid) {\r\n            var prefix = 'https:';\r\n            var rurl = prefix + '//cms.analytics.yahoo.com/cms?partner_id=KRUX';\r\n            var i = new Image();\r\n            i.src = rurl;\r\n        }\r\n})();\r\n</script>", "target": "", "target_action": null, "require": "", "docwrite": null, "template_replacement": 1, "execution_results": null, "tier": 1, "internal": 1, "content_type": "html", "freq_cap": 1, "timing": "onload", "method": "document", "type": "publisher", "id": 88166, "name": "Krux Yahoo! User Match"}, {"content": "<script>\r\n(function(){\r\n  var kuid = Krux('get', 'user');\r\n  if (kuid && typeof kuid != 'undefined') {\r\n      var prefix = location.protocol == 'https:' ? \"https\" :\"http\";\r\n      var r_url = prefix + '://cm.g.doubleclick.net/pixel'\r\n      var kurl = prefix + '://apiservices.krxd.net/um?partner=google&protocol=' + prefix + '&r=' + r_url;\r\n      var i = new Image();\r\n      i.src = kurl;\r\n  }\r\n})();\r\n</script>", "target": "", "target_action": null, "require": "", "docwrite": null, "template_replacement": 1, "execution_results": null, "tier": 1, "internal": 1, "content_type": "html", "freq_cap": 3, "timing": "onload", "method": "document", "type": "publisher", "id": 85453, "name": "NBCUniversal - Google User Matching"}], "buckets": [], "publisher": {"uuid": "54983c83-8810-4a6b-9ff1-81f7349ce967", "id": 10108, "name": "NBCUniversal"}, "controltag_options": {"async": "true", "render": true}, "site": {"id": 26478, "name": "Rotten Tomatoes"}, "realtime_segments": [{"test": ["and", ["or", ["and", ["or", ["intersects", "$page_attr_dart_genre:,", "[\"absurdcomedy\"]"]]]]], "id": "pmefn7ya3"}], "dnt": null, "params": {"connector_host": "connector.krxd.net", "first_party_uid": false, "control_tag_load_sync": "false", "userData_host": "cdn.krxd.net", "disable_http_compression": false, "remove_kxhead": true, "supertag_requires_approval": "false", "control_tag_namespace": null, "cdn_host": "cdn.krxd.net", "control_tag_stats_prefix": "nbcu", "optimize_realtime_segments": false, "beacon_host": "beacon.krxd.net", "control_tag_pixel_throttle": null, "store_realtime_segments": false, "user_id_cookie": null, "max_segments": null, "no_pii": 0, "recommend": false, "revenue_optimization": false, "context_terms": "true", "jslog_host": "jslog.krxd.net", "buckets": "", "site_level_supertag_config": "site", "max_slot_time": 1000, "services_host": "apiservices.krxd.net", "capture_leakage": true, "client_side_storage": "localStorage,cookie", "fingerprint": "false", "config_source": 1, "control_tag_version": "locked", "capture_js_errors": true, "datatag_version": "3", "dfp_premium": "true", "userdata_host": "cdn.krxd.net", "user_data_timing": "load", "target_fingerprint": "false"}, "services": {"event": "//beacon.krxd.net/event.gif", "impression": "//beacon.krxd.net/ad_impression.gif", "stats": "//apiservices.krxd.net/stats", "log": "//jslog.krxd.net/jslog.gif", "optout": "//beacon.krxd.net/optout_check", "config": "//cdn.krxd.net/controltag?confid=", "pixel": "//beacon.krxd.net/pixel.gif", "um": "//apiservices.krxd.net/um", "contentConnector": "//connector.krxd.net/content_connector/", "proxy": "//cdn.krxd.net/partnerjs/xdi", "set_optin": "//apiservices.krxd.net/consumer/optin", "social": "//beacon.krxd.net/social.gif", "set_optout": "//apiservices.krxd.net/consumer/optout", "addSegment": "//cdn.krxd.net/userdata/add", "userData": "//cdn.krxd.net/userdata/get", "data": "//beacon.krxd.net/data.gif", "userdata": "//cdn.krxd.net/userdata/get", "is_optout": "//beacon.krxd.net/optout_check"}, "geo": {}, "segments": [], "confid": "KeXIex0r"};

  // Wrap in a function and comment, then toString the func and replace
  // everything that's not the beginning or end of a JSON object, so we get a
  // string that's either empty or JSON.
  var esiGeo = String(function(){/*
    {"CONTINENT":"NA", "COUNTRY":"US", "REGION":"CA", "CITY":"San Francisco", "DMA":"", "AREACODE":"", "ZIP":"94107", "LATITUDE":"37.770", "LONGITUDE":"-122.393"}
  */}).replace(/^.*\/\*[^{]+|[^}]+\*\/.*$/g, '');

  if (esiGeo) {
    log('Got a request for:', esiGeo, 'adding geo to config.');
    try {
      config.geo = window.JSON.parse(esiGeo);
    } catch (__) {
      // Couldn't parse, so setting to {}
      log('Unable to parse geo from:', config.geo);
      config.geo = {};
    }
  }

  
  
  

  load('//cdn.krxd.net/ctjs/controltag.js.e0ce6829d34e23edb3c90f3615dd81e0', function() {
    
    
    log('Loading krux configuration.');

    Krux('config', config);

    
  });
})();
