Tools‎ > ‎

Google Analytics

The gadget spec URL could not be found
The gadget spec URL could not be found
Google Analytics is the world's best free hit counter.

How to Add Google Analytics to your Website

To add Google Analytics, use the asynchronous script or the traditional script.

Asynchronous Script

Insert just before </head>

<script type="text/javascript">

  var _gaq =[ ['_setAccount', 'UA-XXXX-X'], ['_trackPageview'] ];

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = 'http://www.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

http://code.google.com/apis/analytics/docs/tracking/asyncTracking.html

Multiple trackers

To use multiple trackers

_gaq.push(
  ['_setAccount', 'UA-XXXXX-1'],
  ['_trackPageview'],
  ['b._setAccount', 'UA-XXXXX-2'],
  ['b._trackPageview']
);


Traditional Script

<script src="http://www.google-analytics.com/ga.js" type="text/javascript"></script><script type="text/javascript">try{var g=_gat._getTracker('UA-XXXX-X');g._trackPageview();}catch(ex){}</script>

Track Outgoing Links

To track clicks on external links, add an onclick to every outgoing <a> element.

For example

<a onclick="javascript:pageTracker._trackPageview('/external/evonynet.ourtoolbar.com/exe');" href="http://evonynet.ourtoolbar.com/exe">The Most Complete Evony Toolbar Available!</a>

Show Domain in Report 

To see the top-level or sub-domain for a given page, create a filter.

Why?

If you have a page on http://www.example.com/index.php and another page on http://www.example2.com/index.php, you will see listings in the reports for two distinct index.php pages, and will not be able to distinguish which page is from which domain. You can include the referring domain in the page reports by setting a filter that will include all components of the page URL in the content reports.
  • In the Profile Settings page, click the Add Filter link
  • Choose Add New Filter and provide the filter a name
  • Choose Custom Filter and select Advanced on the Filter type settings
  • Under Advanced settings, choose Hostname for FieldA and Request URI for FieldB
  • Set the values for each of these fields to (.*), which is an expression that captures all characters
  • Set the Output To --> Constructor option to Request URI and provide $A1$B1 as the value for that choice
This will capture the www.example.com portion of your URL and include that at the beginning of your page URL in the content reports section.

See the bottom of
Event Tracking
Comments