Snowplow Java Tracker 0.2.0 released

02 July 2014  •  Jonathan Almeida

We are pleased to announce the release of the Snowplow Java Tracker version 0.2.0.

This release comes shortly after we introduced the community-contributed event tracker a little more than a week ago. In that previous post, we also mentioned our roadmap for the Java Tracker to include Android support as well as numerous other features. This release doesn’t directly act on that roadmap, but is largely a refactoring for future releases of the tracker with a few minor features.

I’ll talk more about the new additions made further down in this post:

  1. Tracker constructor
  2. Renamed method calls
  3. Jackson JSON Processor support
  4. TransactionItem class
  5. Constant & Parameter classes
  6. Miscellaneous
  7. Support

1. Tracker constructor

One of the TrackerC constructors seemed unnecessary so we decided to remove it. The only way to construct a Tracker object now is with the following signature:

public TrackerC(String collector_uri, String namespace, String app_id, boolean base64_encode, boolean contracts)

2. Renamed method calls

We wanted the Java tracker to follow the more native naming convention of Java classes, so method names have been renamed from using underscores for word separators into the camel casing convention. Here are a few examples of renamed method calls:

// Previous
public void track_page_view(String page_url, String page_title, String referrer, String context)
public void track_unstruct_event(String eventVendor, String eventName, String dictInfo, String context)

// Now
public void trackPageView(String page_url, String page_title, String referrer, String context)
public void trackUnstructEvent(String eventVendor, String eventName, String dictInfo, String context)

3. Jackson JSON Processor support

We are standardizing on Jackson for all JSON manipulation on the JVM, so it made sense to do so on the Java Tracker as well. Uses of JSONObject have been replaced with JsonNode with futher changes coming to newer releases.

4. TransactionItem class

Previously, when calling trackEcommerceTransactionItem, you needed to pass in a List<Map<String, String>> that represented all transaction items. This was weakly typed, and we felt it would be better to provide a TransactionItem class that can be used to create individual items. With this change, you now pass a List<TransactionItem> to the tracker instead.

5. Constant & Parameter classes

An early introduction of a Constant & Parameter class that would be used to store various string constants and keys from the Snowplow Tracker Protocol respectively. We wanted to keep a unified place to keep code clean and place for users to add their own keys for unstructured events.

6. Miscellaneous

Some minor changes include initial unit tests, Travis build support, renamed classes, and general code clean up. For more details on this release, please check out the 0.2.0 Release Notes on GitHub.

7. Support

The Snowplow Java Tracker is quite new and is rapidly being developed. We’d love to hear of any feature suggestions from you, or even help setting up the tracker. Feel free to get in touch with us, or raise an issue if you find any bugs.