Snowplow Python Tracker 0.6.0 released


We are pleased to announce the release of version 0.6.0.post1 of the Snowplow Python Tracker. This version adds several methods to help identify users by adding client-side data to events. This makes the Tracker more powerful when used in conjunction with a web framework such as Django or Flask.

The rest of this post will cover:

  1. set_ip_address
  2. set_useragent_user_id
  3. set_domain_user_id
  4. set_network_user_id
  5. Improved logging
  6. Upgrading and compatibility
  7. Other changes
  8. Getting help

1. set_ip_address

The ip_address field in the Snowplow event model is used to look up information about a user’s geographical location among other things. If you have access to a user’s IP address, you can add it to all events concerning that user with the set_ip_address method:


2. set_useragent

The useragent field contains information (sometimes called the “browser string”) about the user’s browser. You can set this field with the set_useragent method:

subject.set_useragent("Mozilla/5.0 (Windows NT 5.1; rv:23.0) Gecko/20100101 Firefox/23.0")

3. set_domain_user_id

The domain_userid field in the Snowplow event model refers to the user ID set by the Snowplow JavaScript Tracker and stored in the ID cookie. If you extract that ID, you can use the set_domain_user_id method to associate a subject with it:


This is useful if you are tracking events both server-side and client-side and want to know when they concern the same user.

4. set_network_user_id

The network_userid field is a user ID set by Snowplow’s Clojure Collector and Scala Stream Collector via a third party cookie. Similarly to the set_domain_user_id method, the set_network_user_id lets you associate a subject with a network user ID:


5. Improved logging

The tracker now logs the endpoint to which events are being sent and, at debug level, each individual event. This brings logging up to par with the Ruby Tracker.

6. Other changes

Some other improvements have been made to the Python Tracker:

  • We have eliminated unnecessary whitespace from the JSON body of POST requests (issue #110)
  • Unicode characters in unstructured events and custom contexts are now preserved rather than converted to ASCII (issue #123)
  • We have added more integration tests for POST requests (issue #122)

7. Upgrading and compatibility

To add the Snowplow Tracker as a dependency to your own Python app, edit your requirements.txt and add:

snowplow-tracker ~> 0.6.0.post1

This version increases the schema version for the JSON holding your custom contexts to 1-0-1 and the schema for all POST request payloads to 1-0-2. These schema versions aren’t supported by versions of Snowplow before 0.9.14, so please upgrade if you have not already.

8. Getting help

Useful links:

If you have an idea for a new feature or want help getting things set up, please get in touch. And raise an issue if you spot any bugs!