This is basically abandonware, but I will accept patches and do basic stuff.
= Introduction =
JGoogleAnalyticsTracker
is a lightweight Java library for tracking your Java application with [http://www.google.com/analytics/ Google Analytics]. It was made so I could use Google’s fantastic analytics software on java gui applications, as Google never made a java implementation for sending tracking data.
Currently the library supports page view tracking (which can have a referrer from a page or a search engine) and event tracking. See the usage section for a basic setup (It’s very simple). JGoogleAnalyticsTracker
will also gracefully ignore requests when there is no internet connection, and logs errors with [http://www.slf4j.org/ SLF4J]. Please feel free to post any feature requests or contact me about questions.
Current maintainers:
= Usage =
This utility is fairly straightforward. First, you make your config data. AnayticsConfigData
automatically populates most of the user information from the client’s system, the only thing it can’t figure out is the Flash version.
{{{ AnalyticsConfigData config = new AnalyticsConfigData("MyTrackingCode"); // if you want to set your own config parameters: config.setFlashVesion("9.0 r24"); // etc }}}
You set up the JGoogleAnalyticsTracker with the config and a version (right now only 4.7.2, but it’s there for future analytics versions):
{{{
JGoogleAnalyticsTracker tracker = new JGoogleAnalyticsTracker(config, GoogleAnalyticsVersion.V_4_7_2);
}}}
and then you can send tracking data with the trackPageView
and trackEvent
methods, or make your own request the makeCustomRequest(AnalyticsRequestData)
method. You can track referrals or searches by calling the trackPageViewFromReferrer
or trackPageViewFromSearch
methods.
For complete documentation, see the [http://www.dmurph.com/jgoogleanalyticstracker/index.html javadocs], or just view the source, it’s very straightforward. For more information on the tracking parameters take a look at Google’s [http://code.google.com/apis/analytics/docs/tracking/gaTrackingTroubleshooting.html Troubleshooting Guide] (although I don't think it's fully updated...)
== Other Features ==
setEnabled(boolean)
.resetSession()
.== Thanks ==
Special thanks to Stefan for helping polish off the project, by adding the proxy support, dispatch modes, and logging. Thanks! :D
== Comparison == So I recently discovered someone made a similar tool, [http://code.google.com/p/jgoogleanalytics/ JGoogleAnalytics]. The differences are (as of 1/11): My library:
== Implementations == I made this library to use in my [http://code.google.com/p/java-simple-mvc/ Java MVC library], which I then use to develop java application like:
Other users:
If you use this library in your application, let me know, I'd love to add you to the list!
I maintain this project on my own time, so any [http://www.dmurph.com/projects.php donations] would be appreciated :)