1. Home
  2. Blog
  3. Releases

Snowplow C++ Tracker 0.1.0 released

We are pleased to announce the release of the Snowplow C++ Tracker. The Tracker is designed to work asynchronously and dependency-free within your C++ code to provide great performance in your applications, games and servers, even under heavy load, while also storing all of your events persistently allowing recovery from temporary network outages.

In the rest of this post we will cover:

  1. How to install the tracker
  2. How to use the tracker
  3. Core features
  4. Roadmap
  5. Documentation
  6. Getting help

1. How to install the tracker

This tracker is source-only and requires no external dependencies. You can get the source code bundle here:

$ wget https://github.com/snowplow/snowplow-cpp-tracker/archive/master.zip

Please check out the C++ Tracker setup guide on our wiki for more information on setup.

That’s it! You’re now ready to start using the Tracker.

2. How to use the tracker

To setup the C++ Tracker you first need include the source files in your project:

  • If you’re using Visual Studio 2015, you’ll need to add everything in include/ and src/ into your project
  • If you’re using macOS or gcc, you’ll need to:
    • Add the include/ and src/ directories into your build
    • Compile/link include/sqlite3.c and include/sqlite3.h (C bindings) separately

You can then instantiate and start a new tracker like so:

#include "tracker.hpp"  Emitter emitter("com.acme.collector", Emitter::Method::POST, Emitter::Protocol::HTTP, 500, 52000, 52000, "events.db"<span class="p">); Tracker *t = Tracker::init(emitter, NULL, NULL, NULL, NULL, NULL, NULL<span class="p">);

You are now ready to track events, so let’s send a screen view event:

string name = "Screen ID - 5asd56"<span class="p">; Tracker::ScreenViewEvent sve<span class="p">; sve.name = &name<span class="p">; Tracker::instance()->track_screen_view(sve<span class="p">);

And that’s all there is to it! Please check out the C++ Tracker technical documentation on our wiki for the tracker’s full API.

3. Core features

The core features of the Snowplow C++ Tracker include:

  • Asynchronous event sending
  • Outbound events are cached in a SQLite database to prevent event loss
  • Value checking for all events to ensure invalid events are caught early

The general flow of the Tracker as an event goes through:

  • A Tracker::instance()->track_* method is invoked
  • The event is stored in the local database
  • A long running worker thread processes these events (started on Tracker::init())
  • This process will then pull a range of events from the database and begin sending them to your configured collector URI
  • More events arriving during sending will just be written to the database, and will then be picked up by the background sending process
  • Each request is sent using a std::future

This model is very closely related to the one used in the Golang, Android, Objective-C and Unity Trackers, which are all backed by Sqlite databases.

The Tracker also contains full support for secure event sending by both GET and POST request types, and the ability to combine events, for POST, up to a configurable byte limit. This yields much better performance versus our old approach of buffer limits.

4. Roadmap

Currently the Snowplow C++ Tracker only supports macOS and Windows, but we’re looking to support Linux in the future!

5. Documentation

6. Getting help

We hope that you find the Snowplow C++ Tracker useful – of course, this is only its first release, so don’t be afraid to get in touch or raise an issue on GitHub!

More about
the author

Snowplow Team
View author

Ready to start creating rich, first-party data?

Image of the Snowplow app UI