Snowplow Ruby Tracker 0.8.0 released

We are pleased to announce a new release of the Snowplow Ruby Tracker, now on version 0.8.0.

In fact we didn’t get around to announcing version 0.7.0 before going straight to 0.8.0! We’ve added several features as well as improving the API:

Features

  • Add event-specific Subject properties to your events
  • Add page properties to your non-page view events
  • Comprehensive new API documentation using YARD
  • Set domain_session_id and domain_session_idx event properties
  • Set your own Emitter path
  • Configure the Emitter logger

Improvements

  • Added keyword arguments to improve the API BREAKING CHANGE
  • Removed the Contracts type checking gem
  • Brought the code in line with Rubocop style

Fixes

  • Added “app” and “web” to the list of possible platforms
  • Fixed eCommerce events not supporting the Ruby 1.9-style hash notation

The change from version 0.7.0 to 0.8.0 is the removal of the type-checking gem Contracts. This was required because it didn’t work in Ruby 3.0 with keyword arguments. We had already been considering depreciating it, as throwing RunTime errors for mistakes in your tracking seemed undesirable, and some users found that it clashed with their existing Contract class. Testing your tracking code is important to make sure you are generating the events you expect.

The big (breaking) change for version 0.7.0 was the addition of keyword arguments. This change makes the code much more readable. Almost all public API methods now use keyword arguments.

# From this:
tracker.track_struct_event("demo", "explain", nil, nil, nil, [entity])
# To this:
tracker.track_struct_event(category: "demo", action: "explain", context: [entity])

We’ve added a new class, Page. You can add Page objects to any track_x_event method call, allowing you to directly populate the page_url, page_title, and referrer properties for all your event types. Similarly, you can also now attach Subject objects to any track_x_event method call. This means you can easily set different user properties for every event.

Thanks to some community contributions, event sending is now more configurable. An Emitter path option can be set (thanks @larubbio), and the Emitter logger is now configurable (thanks @mcls). Following a request from @PatrikTrelsmoJualo, we have also added Subject methods for setting domain_session_id and domain_session_idx, to help with matching events between the Snowplow JavaScript and Ruby trackers. As always, we love hearing from our users. Please feel free to comment or contribute!

Finally, we’ve completely rewritten the Snowplow documentation, as well as adding comprehensive new API/technical documentation.

Upgrading
Specify the new version in your Gemfile:

gem "snowplow-tracker", "~> 0.8.0"

Update your code to use the new keyword arguments API.

6 Likes