I have attached my GoogleAnalytics.cs file at the bottom of this page as well as the page I use to render the results.  This is definitely not a final product, as I just wrote it over a few hours yesterday, but feel free to take a look.

If you have any questions please feel free to contact me at Matthew.Goodrich@ColoState.edu

I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Tracking Code Samples

Sample tracking code for self-reference:

Event-Tracking (eg, to track how many times a pdf was downloaded):

<a href="#" onClick="_gaq.push(['_trackEvent', 'PDFs', 'Downloaded', 'DSA Annual Report']);">DSA Annual Report</a>

More info can be found at http://code.google.com/apis/analytics/docs/tracking/eventTrackerGuide.html.

A Single Domain:

<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push([‘_setAccount’, ‘UA-XXXXXXXX-X’]);
  _gaq.push([‘_trackPageview’]);
  (function() {
    var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
    ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’;
    var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);
  })();
</script>
 
One domain with multiple subdomains:
Examples:apps.csuphc.colostate.edu
store.csuphc.colostate.edu
video.csuphc.colostate.edu
 <script type=”text/javascript”>
  var _gaq = _gaq || [];
  _gaq.push([‘_setAccount’, ‘UA-XXXXXXXX-X’]);
  _gaq.push([‘_setDomainName’, ‘.csuphc.colostate.edu’]);
  _gaq.push([‘_trackPageview’]);
  (function() {
    var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
    ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’;
    var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);
  })();
</script>
Multiple top-level domains
Examples:www.csuphc.colostate.co.uk
www.csuphc.colostate.com
www.csuphc.colostate.net

 

 

<script type=”text/javascript”>
  var _gaq = _gaq || [];
  _gaq.push([‘_setAccount’, ‘UA-23393736-2’]);
  _gaq.push([‘_setDomainName’, ‘none’]);
  _gaq.push([‘_setAllowLinker’, true]);
  _gaq.push([‘_trackPageview’]);
  (function() {
    var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
    ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’;
    var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);
  })();
</script>