We’re extremely excited to announce our initial release of the Snowplow iOS Tracker.
Mobile trackers have been one of the Snowplow community’s most highly requested features, and we are very pleased to finally have this ready for release. The Snowplow iOS Tracker will allow you to track Snowplow events from your iOS applications and games.
This release comes with many features you may already be familiar with in other Snowplow Trackers, along with a few extra tricks as well!
The Snowplow iOS Tracker is published as a Pod on CocoaPods, the dependency manager for Objective-C projects. This makes it easy to install the Tracker with minimal effort, and is the recommended way for installing the Tracker.
First, make sure you have CocoaPods installed on your machine if you haven’t already:
To add the Snowplow iOS Tracker as a dependency to your iOS project, create a
Podfile and add the following line:
Then execute the following line to download and install the Snowplow Tracker:
The Snowplow iOS Tracker is compatible with iOS applications 7.0 and higher. The setup page has more information on the Tracker’s dependencies.
To use the Tracker you need to create a Tracker and Request instance. The
SnowplowRequest class is used to send events created by the
You can create a
SnowplowRequest instance easily:
SnowplowTracker in a similar fashion:
You can easily add some additional information to each event, such as a user ID:
We can then fire some events like so:
For in-depth information on using the Snowplow iOS Tracker, please see the wiki page.
The Tracker also grabs a set of mobile-specific contextual data, which we add to each event’s context array following the mobile context schema.
If you’re using Redshift, you would need to install the mobile_context table using this script.
The Snowplow iOS Tracker comes with a built-in caching feature to store any event that wasn’t able to to be sent because of network connectivity failures or if events are unsent before a user exits your application. The events are stored in an sqlite database in the application’s Library directory. The Tracker uses the FMDB SQLite wrapper to do this.
For sending events, we use the AFNetworking library. This simplifies the process of sending network requests, and should make it easier to extend the Tracker in the future.
This is an initial release of the iOS Tracker and we look forward to further releases based on your real-world usage of the tracker. We’re looking forward to user feedback, feature requests or possible bugs. Feel free to get in touch or raise an issue on GitHub!