Python Tracker
The Snowplow Python Tracker allows you to track Snowplow events from your Python apps and games.
The tracker should be straightforward to use if you are comfortable with Python development; any prior experience with Snowplow's JavaScript Tracker, Google Analytics or Mixpanel (which have similar APIs to Snowplow) is helpful but not necessary.
There are three basic types of objects you will create when using the Snowplow Python Tracker: subjects, emitters, and trackers.
A subject represents a user whose events are tracked. A tracker constructs events and sends them to one or more emitters. Each emitter then sends the event to the endpoint you configure. This will usually be a Snowplow collector, but could also be a Redis database or Celery task queue.
📄️ Setup
Integration options
📄️ Initialization
Assuming you have completed the Python Tracker Setup for your Python project, you are now ready to initialize the Python Tracker.
📄️ Adding extra data: The Subject class
You may have additional information about the user (i.e. subject) performing the action or the environment in which the user has performed the action. Some of that additional data can be sent into Snowplow with each event as part of the subject class.
📄️ Tracking specific events
As a Snowplow user, you have the access to a wide selection of event types and associated methods for tracking as well as the ability to define your own event types:
📄️ Emitters
Tracker instances must be initialized with an emitter. This section will go into more depth about the Emitter class and its subclasses.
📄️ Contracts
Python is a dynamically typed language, but each of our methods expects its arguments to be of specific types and value ranges. To avoid wrong inputs, the tracker takes two approaches:
📄️ Logging
The emitters.py module has Python logging turned to give you information about requests being sent. The logger prints messages about what emitters are doing. By default, only messages with priority "INFO" or higher will be logged.
📄️ The RedisWorker class
Important note
📄️ Upgrading to Newer Versions
This page gives instructions to upgrading to newer versions of the Python Tracker