title: Google Analytics Tracker Code (GATC) [a Javascript] needs to be modified to enable it to run in JSF
body: <p>In a few days, I have a small event in which I have to demonstrate the Google Analytic thoroughly <strong>only in JSF</strong>. I have registered myself on the Google Analytics site <a href="http://www.google.com/analytics/" rel="nofollow">here</a> and performed the rest of the necessary steps. I obtained the following code in Javascript on that site.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      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"));
  &lt;/script&gt;
  
  &lt;script type="text/javascript"&gt;
     try{
            var pageTracker = _gat._getTracker("UA-xxxxxx-x");
            pageTracker._trackPageview();
        } 
     catch(err) {}
  &lt;/script&gt;
  </code></pre>
  
  <hr>
  
  <p>It is called <strong>Google Analytics Tracker Code (GATC)</strong> which when included on pages of a web site, the relevant information regarding the page can be view as a report. It can be used to track all the usual site activities, such as  visits, page views, page per visits, bounce rate, average time on the site etc. This is much about GATC. I have to demonstrate it only in JSF and therefore, some necessary changes must be done in order to make the above Javascript code run in JSF, since JSF uses some different way to compile Javascript. Which necessary changes need to be made in the above Javascript code so that it can run in JSF also, can I find a website on the internet which uses Google Analytic? (so that I need not upload my JSF application for demonstration which I have already developed in JSF) and If such a website(s) exists, can it be used just for demonstration? On which event of Javascript, this code should be placed? I found some relevant questions on Google Analytic already posted here but they were not especially related to JSF.</p>