?> Snowplow iOS Tracker 0.1.1 released | Snowplow
Snowplow Outperforms GA4 in GigaOm Comparative Evaluation.
Read More
  1. Home
  2. Blog
  3. Releases
Releases

Snowplow iOS Tracker 0.1.1 released

Jump to

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!

  1. How to install the tracker
  2. How to use the tracker
  3. Mobile context
  4. Under the hood
  5. Getting help

1. How to install the tracker

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:

$ gem install cocoapods

To add the Snowplow iOS Tracker as a dependency to your iOS project, create a Podfile and add the following line:

platform :ios pod 'SnowplowTracker'

Then execute the following line to download and install the Snowplow Tracker:

$ pod install

The Snowplow iOS Tracker is compatible with iOS applications 7.0 and higher. The setup page has more information on the Tracker’s dependencies.

2. How to use the tracker

To use the Tracker you need to create a Tracker and Request instance. The SnowplowRequest class is used to send events created by the SnowplowTracker.

You can create a SnowplowRequest instance easily:

NSURL *url = [NSURL URLWithString:"collector.acme.net"]; SnowplowRequest *collector = [[SnowplowRequest alloc] initWithURLRequest:url httpMethod:@"POST"];

And a SnowplowTracker in a similar fashion:

SnowplowTracker *tracker = [[SnowplowTracker alloc] initWithCollector:collector appId:@"AF003" base64Encoded:false namespace:@"cloudfront"];

You can easily add some additional information to each event, such as a user ID:

[tracker setUserId:"a73e94"];

We can then fire some events like so:

[tracker trackPageView:@"www.example.com" title:@"example page" referrer:@"www.referrer.com"]; [tracker trackStructuredEvent:"shop" action:"add-to-basket" property:"pcs" value:2 timestamp:1369330909];

For in-depth information on using the Snowplow iOS Tracker, please see the wiki page.

3. Mobile context

The Tracker automatically grabs the user’s timezone, user language and other details, in a similar fashion to the Snowplow JavaScript Tracker.

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.

4. Under the hood

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.

5. Getting help

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!

More about
the author

Avatar
Snowplow Team
View author

Ready to start creating rich, first-party data?

Image of the Snowplow app UI