/* Controltag Loader for IDG Enterprise */
(function(){
  function debugLog(msg) {
    var isDebug = /kxdebug=(1|true)/.test(location);
    if (isDebug && typeof window.console === 'object' && typeof console.info === 'function') {
      console.info(msg);
    }
  }

  function loadCT(url, callback) {
    debugLog('Loading Krux control tag.');
    var ct_element = document.createElement('script');
    ct_element.async = true;
    ct_element.src = url;

    ct_element.onload = ct_element.onreadystatechange = function() {
      var state = ct_element.readyState;
      if (!callback.done && (!state || /loaded|complete/.test(state))) {
        callback.done = true;
        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(ct_element, sibling);
  };

  function loadConfig() {
    
    
    debugLog('Loading krux configuration.');

    var config = {"partner_segment_map": {}, "context_terms": [], "tags": [{"content": "<script type=\"text/javascript\">Krux('social.init');</script>", "target": null, "target_action": "append", "require": "", "docwrite": null, "internal": 1, "method": "document", "execution_results": null, "tier": 1, "library_tag_config": {}, "content_type": "html", "timing": "onload", "type": "library", "id": 28056, "name": "Krux Track Social"}, {"content": "<script>\r\n// this tag is intentionally blank\r\n</script>", "target": null, "target_action": "append", "require": "", "docwrite": null, "method": "document", "execution_results": null, "tier": 1, "internal": 6, "content_type": "html", "freq_cap": 3, "timing": "onload", "type": "data provider", "id": 28057, "name": "Technographic Data provider tag"}, {"content": "", "target": null, "target_action": "append", "require": "", "docwrite": null, "method": "document", "execution_results": null, "tier": 1, "internal": 14, "content_type": "html", "freq_cap": 3, "timing": "onload", "id": 28058, "name": "Krux Geographic Data provider tag"}, {"content": "<script>\r\n(function(){\r\n  var kuid = Krux('get', 'user');\r\n  if (kuid) {\r\n    Krux('require:http').pixel({\r\n      url: \"//p.acxiom-online.com/pixel/sci\",\r\n      data: {\r\n          uid: kuid,\r\n          _kdpid: 'f19b7626-3732-4dcc-bac5-8d2c937dae9a',\r\n          pid: 3021\r\n      }});\r\n  }\r\n  })();\r\n</script>", "target": null, "target_action": "append", "require": "", "docwrite": null, "method": "document", "execution_results": null, "tier": 1, "internal": 21, "content_type": "html", "freq_cap": 3, "timing": "onload", "type": "data provider", "id": 28076, "name": "Acxiom S2S provider tag"}, {"content": "<script>\r\n(function() {\r\n  // krxd.nexac.com throws SSL cert errors so only fire this tag\r\n  // on HTTP pages\r\n  if (location.protocol == \"http:\") {\r\n      var Krux = window.Krux;\r\n      var kuid = Krux('get', 'user');\r\n      if (kuid) {\r\n         var u = \"http://krxd.nexac.com/dlx.gif?_kdpid=2dd640a6-6ebd-4d4f-af30-af8baa441a0d&kuid=\" + kuid;\r\n         (new Image()).src = u;\r\n      }\r\n   }\r\n})();\r\n</script>", "target": null, "target_action": "append", "require": "", "docwrite": null, "method": "document", "execution_results": null, "tier": 1, "internal": 8, "content_type": "html", "freq_cap": 3, "timing": "onload", "type": "data provider", "id": 28077, "name": "DataLogix provider tag"}, {"content": "<script>\r\n(function(){\r\n  if (window.KRUX) {\r\n    var pubid = KRUXSetup.pubid;\r\n  } else if (window.Krux) {\r\n    var pubid = Krux('get', 'pubid');\r\n  } else { \r\n    return;\r\n  }\r\n  var prefix = location.protocol == 'https:' ? \"https:\" : \"http:\";\r\n  var kurl = prefix + '//beacon.krxd.net/data.gif?_kdpid=890a6228-04af-4630-85b6-0b49dee6157f&pid=' + pubid;\r\n  var u = prefix + '//api.bizographics.com/v1/profile.redirect?api_key=595bae8dbc0c4c42b4544e688b10c002' + \r\n        '&callback_url=' + escape(kurl);\r\n  var i = new Image();\r\n  i.src = u;\r\n})();\r\n</script>", "target": null, "target_action": "append", "require": "", "docwrite": null, "method": "document", "execution_results": null, "tier": 1, "internal": 2, "content_type": "html", "freq_cap": 3, "timing": "onload", "type": "data provider", "id": 28078, "name": "Bizo provider tag"}, {"content": "<script>\r\n(function(){\r\n  var kuid = Krux('get', 'user');\r\n  if (kuid) {\r\n    Krux('require:http').pixel({\r\n      url: \"//loadm.exelator.com/load\",\r\n      data: {\r\n          _kdpid: 'e4942ff0-4070-4896-a7ef-e6a5a30ce9f9',\r\n          buid: kuid,\r\n          p: '204',\r\n          g: '270',\r\n          j: '0'\r\n      }});\r\n  }\r\n  })();\r\n</script>", "target": null, "target_action": "append", "require": "", "docwrite": null, "method": "document", "execution_results": null, "tier": 1, "internal": 11, "content_type": "html", "freq_cap": 3, "timing": "onload", "type": "data provider", "id": 28079, "name": "eXelate Media provider tag"}, {"content": "<script>\r\n(function() {\r\n\u00a0 if (window.s && window.s.prop2) {\r\n    var krx_p42 = window.s.prop2.split(/:/);\r\n    if (krx_p42.length >= 1) {\r\n\u00a0 \u00a0   Krux('set', 'section', krx_p42[0]);\r\n    }\r\n    if (krx_p42.length >= 2) {\r\n\u00a0 \u00a0   Krux('set', 'subsection', krx_p42[1]);\r\n    }\r\n  }\r\n})();\r\n</script>", "target": "", "target_action": null, "require": "", "docwrite": null, "method": "document", "execution_results": null, "tier": 1, "internal": 1, "content_type": "html", "timing": "onload", "type": "publisher", "id": 14024, "name": "ComputerWorld"}], "segments": [], "publisher": {"uuid": "c0535245-d1de-49ff-b2a3-236d27f0d078", "id": 10362, "name": "IDG Enterprise"}, "controltag_options": {"async": "true", "render": true}, "site": {"id": 11946, "name": "Computerworld"}, "dnt": null, "params": {"revenue_optimization": false, "control_tag_pixel_throttle": null, "context_terms": "false", "jslog_host": "jslog.krxd.net", "capture_js_errors": true, "control_tag_load_sync": "false", "remove_kxhead": true, "site_level_supertag_config": "site", "max_slot_time": 1000, "services_host": "apiservices.krxd.net", "capture_leakage": true, "max_segments": null, "client_side_storage": "localStorage,cookie", "control_tag_stats_prefix": null, "user_id_cookie": null, "no_pii": 0, "beacon_host": "beacon.krxd.net", "control_tag_namespace": null, "control_tag_version": "stable", "datatag_version": "3", "supertag_requires_approval": false}, "services": {"impression": "//beacon.krxd.net/ad_impression.gif", "stats": "//apiservices.krxd.net/stats", "log": "//jslog.krxd.net/jslog.gif", "userData": "//apiservices.krxd.net/user_data/segments/3", "optout": "//beacon.krxd.net/optout_check", "pixel": "//beacon.krxd.net/pixel.gif", "um": "//apiservices.krxd.net/um", "is_optout": "//beacon.krxd.net/optout_check", "set_optin": "//apiservices.krxd.net/consumer/optin", "social": "//beacon.krxd.net/social.gif", "set_optout": "//apiservices.krxd.net/consumer/optout", "data": "//beacon.krxd.net/data.gif", "event": "//beacon.krxd.net/event.gif"}, "geo": {}, "realtime_segments": [], "confid": "Hx-x6U34"};

    // 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(){/*
      <esi:include src="/geoip_esi"/>
    */}).replace(/^.*\/\*[^{]+|[^}]+\*\/.*$/g, '');

    if (esiGeo) {
      config.geo = esiGeo;
    }

    Krux('config', config);
    
  };

  loadCT( "//cdn.krxd.net/ctjs/controltag.js.f99670595ccd46c65a517672ea749179", loadConfig );
})();