Version 5.0
AdvertServe User Manual :: v5.0

AdGear Click Tracking

Note Note

Manually making the changes documented here to activate click tracking is no longer necessary. As of version 3.0 the ad server will automatically make these changes for you when creating or editing a media. These examples are only provided as a reference so you can see if a particular code format is recognized or not. Please submit unrecognized codes to support for addition to our automated processing rules.

JavaScript Code

Original Code

You should have received some JavaScript code from AdGear that looks like the following:


<script type="text/javascript" language="JavaScript">
(function() {
  ADGEAR_SOURCE_CLICKTRACKER = "[CCS]";
  ADGEAR_SOURCE_CLICKTRACKER_EXPECTS_ENCODED = false;
  ADGEAR_SOURCE_CLICKTRACKER_IS_ENCODED = false;
  ADGEAR_SOURCE_CLICKTRACKER_IS_DOUBLE_ENCODED = false;
  var randomnum = "[CB]";
  var proto = "http:";
  if (window.location.protocol == "https:") proto = "https:";
  if (randomnum.substring(0,2) == "__") randomnum = String(Math.random());
  document.writeln('<scr' + 'ipt type="text/ja' + 'vascr' + 'ipt" s' + 'rc="' +
      proto + '//dcs.adgear.com' + '/impressions/ext/p=' +
      '40618' + '.js?AG_R=' + randomnum + '"></scr' + 'ipt>');
})();
</script>

Modified Code

What you need to do is modify the variables in the <SCRIPT> code as shown by the highlighted changes:


<script type="text/javascript" language="JavaScript">
(function() {
  ADGEAR_SOURCE_CLICKTRACKER = "%%CLICKTAG%%";
  ADGEAR_SOURCE_CLICKTRACKER_EXPECTS_ENCODED = true;
  ADGEAR_SOURCE_CLICKTRACKER_IS_ENCODED = true;
  ADGEAR_SOURCE_CLICKTRACKER_IS_DOUBLE_ENCODED = false;
  var randomnum = "[CB]";
  var proto = "http:";
  if (window.location.protocol == "https:") proto = "https:";
  if (randomnum.substring(0,2) == "__") randomnum = String(Math.random());
  document.writeln('<scr' + 'ipt type="text/ja' + 'vascr' + 'ipt" s' + 'rc="' +
      proto + '//dcs.adgear.com' + '/impressions/ext/p=' +
      '40618' + '.js?AG_R=' + randomnum + '"></scr' + 'ipt>');
})();
</script>

IFRAME Code

Original Code

You should have received some IFRAME code from AdGear that looks like the following:


<script type="text/javascript" language="JavaScript">
(function() {
  var clicktracker = "[CCS]";
  var clicktracker_expects_encoded = false;
  var clicktracker_is_encoded = true;
  var clicktracker_is_double_encoded = false;
  var randomnum = "[CB]";
  var proto = "http:";
  var host = "cdn.adgear.com";
  var bucket = "acs";
  if (window.location.protocol == "https:") {
    proto = "https:";
    host = "acs.adgear.com";
    bucket = "";
  }
  var iframe_url = proto + '//' + host + '/' + bucket + '/adgear.js/current/iframes/iframe_placement.html';
  var iframe_id = "adgearExtIframe_" + "40618";

  if (randomnum.substring(0,2) == "__") randomnum = String(Math.random());
  iframe_url = iframe_url + "?AG_PID=" + "40618" +
      "&AG_R=" + randomnum +
      "&AG_SOURCE_CLICKTRACKER_EXPECTS_ENCODED=" + clicktracker_expects_encoded +
      "&AG_SOURCE_CLICKTRACKER_IS_ENCODED=" + clicktracker_is_encoded +
      "&AG_SOURCE_CLICKTRACKER_IS_DOUBLE_ENCODED=" + clicktracker_is_double_encoded +
      "&AG_SOURCE_CLICKTRACKER=" + encodeURIComponent(clicktracker);
  document.writeln('<iframe name="' + iframe_id + '" id="' + iframe_id + '" height="' +
      '90' + '" width="' + '728' + '" src="' + iframe_url +
      '" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>');
})();
</script>

Modified Code

What you need to do is modify the variables in the <SCRIPT> code as shown by the highlighted changes:


<script type="text/javascript" language="JavaScript">
(function() {
  var clicktracker = "%%CLICKTAG%%";
  var clicktracker_expects_encoded = true;
  var clicktracker_is_encoded = true;
  var clicktracker_is_double_encoded = false;
  var randomnum = "[CB]";
  var proto = "http:";
  var host = "cdn.adgear.com";
  var bucket = "acs";
  if (window.location.protocol == "https:") {
    proto = "https:";
    host = "acs.adgear.com";
    bucket = "";
  }
  var iframe_url = proto + '//' + host + '/' + bucket + '/adgear.js/current/iframes/iframe_placement.html';
  var iframe_id = "adgearExtIframe_" + "40618";

  if (randomnum.substring(0,2) == "__") randomnum = String(Math.random());
  iframe_url = iframe_url + "?AG_PID=" + "40618" +
      "&AG_R=" + randomnum +
      "&AG_SOURCE_CLICKTRACKER_EXPECTS_ENCODED=" + clicktracker_expects_encoded +
      "&AG_SOURCE_CLICKTRACKER_IS_ENCODED=" + clicktracker_is_encoded +
      "&AG_SOURCE_CLICKTRACKER_IS_DOUBLE_ENCODED=" + clicktracker_is_double_encoded +
      "&AG_SOURCE_CLICKTRACKER=" + encodeURIComponent(clicktracker);
  document.writeln('<iframe name="' + iframe_id + '" id="' + iframe_id + '" height="' +
      '90' + '" width="' + '728' + '" src="' + iframe_url +
      '" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>');
})();
</script>