/*
-------------------------------------------------
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>

<script src="http://www.yourdomain.com/exact_adwords_keywords.js" type="text/javascript"></script>

<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-XXXXXX-X");
pageTracker._trackPageview();
</script>
-------------------------------------------------
*/

if (typeof(_gat)=="object") {
  var keywordTracker = _gat._getTracker("UA-1");
  keywordTracker._initData();
  
  if (document.location.search.match("gclid")||document.location.search.match("cpc")) {
    var eak_search_query = document.referrer.match(/(\?|&)(q|p|query)=([^&]*)/);
    if (eak_search_query) {
      var eak_keywords = decodeURIComponent(eak_search_query[3]);
      
      // Convert all characters to lower case
      eak_keywords = eak_keywords.toLowerCase();

      // Replace + with space and clear extra whitespace at both ends of the
      // search string
      eak_keywords = eak_keywords.replace(/\+/g,' ').replace(/^\s\s*/, '').replace(/\s\s*$/, '');

      // Set the User defined variable
      keywordTracker._setVar(eak_keywords);
    }
  }
}

