The Snowplow Java Tracker is a simple client library for Snowplow, designed to send raw Snowplow events to a Snowplow collector. Use this tracker to add analytics to your Java-based desktop and server apps, servlets and games.
In the rest of this post we will cover:
We were hugely excited to receive the Pull Request from Kevin for a new Java Tracker. We asked him if he could share some background on what brought him to write the tracker, here he is in his own words:
I wrote the Java Tracker as a starting point for a summer internship with a very innovative technology solutions company in Chicago called Saggezza. I’m working in their Big Data branch, and the vision is to integrate a tracking service that will be largely influenced by the Snowplow methods into Big Data pipelines.
The Java Tracker I coded configures a payload for many types of tracking events. It then sends the information to a collector URI using the Apache
httpclient library. The most interesting part about this project to me was that it required a combination of web knowledge and data handling. I was a more a front-end web developer turned back-end, so I enjoyed using a degree of knowledge on how a request payload functions while debating which data structures would handle information most efficiently to keep the tracker fast and reliable.
The Snowplow Java Tracker has been built and tested against Java Development Kit 6, so should work with apps written in JDK6+, i.e. apps targeting Java SE 6 and up.
The Tracker does not yet support Android. We will decide on the best course of action for adding Android support shortly.
We have not yet tested the tracker from Scala, Clojure or JRuby.
The release version of this tracker (0.1.0) is available within Snowplow’s Maven repository. We have instructions for installing the tracker for Maven, Gradle and SBT in the Java Tracker Setup guide.
Here is the Gradle setup for example:
Require the Tracker module in your Java code like so:
You are now ready to initialize a tracker instance, for example:
Now let’s send in a couple of events:
And that’s it! Please check out the Java Tracker documentation on the wiki for the tracker’s full API.
We have big plans for the Snowplow Java Tracker, including but not limited to:
If there are other features you would like to see, feel free to add an issue to the repository.
And that’s it; enormous thanks to Kevin Gleason for his work making the Snowplow Java Tracker a reality. We are really excited to have our first community-contributed tracker and hope it is the first of several from Snowplow users!
We hope that you find the Snowplow Java Tracker helpful - it is of course still very young, so don’t be afraid to get in touch and let us know what features you would like to see added next. And of course, do raise an issue if you spot any bugs!