Google Analytics (GA) is a free Web Analytics tool from Google. If you are looking to get some insights into web properties or desktop applications usage, and willing to share that data with Google, it is a great choice. For web properties it is straight forward (include the js file given by GA and it just works. However, for desktop applications where there is no web context, it has been little tricky. You had to simulate the web with cookie support etc.
GA is rolling out new protocol called Measurement Protocol, which supports collecting the tracking data in client device agnostic way. It is part of their Universal Analytics product and it is still in beta and soon it will replace the current way of tracking the data.
If you want to use GA in Java server or desktop environment, unfortunately GA doesn’t provide any Java API. Recently I came across this situation and was hoping that there would be some third party API implementing this protocol. But I found none which implements full protocol. So end up creating google-analytics-java library.
It is open sourced in github and deployed in Maven Central. If you have such need, try it out and see if it helps you. If there are any issues or missing features, you can send me a pull request or log an issue.