gwt-gatracker


Google Analytics API for Google Web Toolkit

GATracker offers a way to track website visitors with Google Analytics in GWT applications.

Locate the GATracker class in the client side of the GWT project, this class offers all the methods currently available in the Google Analytics API making very easy to add the analytics functionality programatically in your project.

Copy the analytics snippet (javascript code) in the html pages of the GWT project so that it appears before the closing html "body" tag as follows:

```

var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX-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); })();

```

And replace UA-XXXXX-X with your Google Analytics account ID for your web app.

The snippet above represents the minimum configuration needed to track a page asynchronously.

Project Information

The project was created on Jan 9, 2012.

Labels:
gwt Tracking Analytics Toolkit Integration Web