Golang Tracker
The Snowplow Golang Tracker allows you to track Snowplow events from your Golang apps and servers.
There are four basic types of object you will create when using the Snowplow Golang Tracker: subjects, emitters, storage and trackers.
- A subject represents a user whose events are tracked.
- A tracker constructs events and sends them to an emitter.
- The emitter then sends the event to the endpoint you configure, a valid Snowplow Collector, which leverages a storage implementation to store them securely before sending to allow for recovery from failure.
As sending and processing of events is done asynchronously it is advised to create the Tracker as a singleton object. This is due to the fact that all events are first persistently stored in a local Sqlite3 database; if multiple Trackers are created there is the possibility of duplicate sending of events and overt consumption of resources.
See here for instructions on building a Singleton in Golang.
๐๏ธ Setup
Tracker compatibility
๐๏ธ Initialization
Import the library
๐๏ธ Tracking the Subject
You may have additional information about your application's environment, current user and so on, which you want to send to Snowplow with each event.
๐๏ธ Tracking specific events
Tracking methods supported by the Golang Tracker at a glance:
๐๏ธ Emitters
Tracker instances must be initialized with an emitter. This section will go into more depth about the Emitter and how it works under the hood.