Snowplow Golang Tracker 2.4.0 released

Paul Boocock

We are pleased to announce a new release of the Snowplow Golang Tracker.

Version 2.4.0 introduces the capability to set the Subject on each event, overwriting the Subject set at the Tracker level. This allows for more fine grained control of Subject properties when sending events to a Snowplow collector from the Golang tracker.

Read on below for more details on:

  1. Set Subject per event
  2. Installation and upgrading
  3. Documentation and help

1. Set Subject per event

The Snowplow Golang Tracker now allows for a different Subject to be set for each event. This feature is useful when using the Golang Tracker in a server side scenario where requests are being processed but each request belongs to a different Subject, such as a web server.

You can leverage this functionality by passing a Subject into each track... method:

	trackerSubject := InitSubject()
	trackerSubject.SetUserId("123456789")

	tracker := InitTracker(
		RequireEmitter(InitEmitter(
			RequireCollectorUri("com.acme.collector"),
		)),
		OptionSubject(trackerSubject),
	)

	eventSubject := InitSubject()
	eventSubject.SetUserId("987654321")

	tracker.TrackPageView(PageViewEvent{
		PageUrl:  NewString("acme.com"),
		Contexts: contextArray,
		Subject:  eventSubject,
	})

	// Event Level 987654321 will be tracked as the UID (user_id)

	tracker.TrackPageView(PageViewEvent{
		PageUrl:  NewString("acme.com"),
		Contexts: contextArray,
	})

	//  Tracker Level 123456789 will be tracked as the UID (user_id)

2. Installation and upgrading

You can install the Snowplow Golang Tracker using gopkg or go modules:

	$host go get gopkg.in/snowplow/snowplow-golang-tracker.v2/tracker

	# OR

	$host go get github.com/snowplow/snowplow-golang-tracker/v2/tracker # When using modules

It can then be imported into your applications:

	import "gopkg.in/snowplow/snowplow-golang-tracker.v2/tracker"

	# OR

	import "github.com/snowplow/snowplow-golang-tracker/v2/tracker" # When using modules

3. Documentation and help

For help on integrating the tracker please have a look at the setup guide. Information about how to use the tracker can be found in the Golang Tracker documentation. If you have any questions or run into any problems, please visit our Discourse forum.

You can find the full release notes on GitHub as Snowplow Golang Tracker v2.4.0 release.

Please raise any bugs in the Golang Tracker’s issues on GitHub.

Related articles