Repository navigation
iOS Tracker Setup 0.1 0.3
HOME > SNOWPLOW SETUP GUIDE > Step 2: Setup a Tracker > iOS tracker
-
- 2.1 Tracker compatibility
- 2.2 Dependencies
-
- 3.1 CocoaPods
- 3.2 Manual setup
The Snowplow iOS Tracker lets you add analytics to your iOS-based applications.
The Tracker should be relatively straightforward to setup if you are familiar with iOS development using CocoaPods.
Ready? Let's get started.
With iOS backward compatibility is limited to a small range which it makes it easy to support. Hence, our goal was to make the iOS Tracker compatible with iOS 6+ with easy availability via CocoaPods.
The tracker has dependencies limited to the AFNetworking and FMDB libraries for networking and database management respectively. Both of which have iOS 6+ support as well. If you're installing via CocoaPods, these dependencies are recursively downloaded for your project so you don't have to worry about it.
We support installing the iOS Tracker via CocoaPods since it's the easiest way to install the tracker. Doing so is simple:
- Install CocoaPods using
gem install cocoapods - Create the file
Podfilein the root of your XCode project directory, if you don't have one already - Add the following line into it:
pod 'SnowplowTracker'
- Run
pod installin the same directory
If you prefer not to use CocoaPods, you can grab the tracker from our GitHub repo and import it into your project.
First, git clone the latest version of the tracker to your local machine:
git clone https://github.com/snowplow/snowplow-objc-tracker.git
If you don't have git installed locally, install it first.
You only need to copy the tracker's Snowplow sub-folder into your XCode project's folder. The command will look something like this:
cp -r snowplow-objc-tracker/Snowplow MyObjcApp/MyObjcApp/
Replace MyObjcApp with the name of your own app, and tweak the source code sub-folder accordingly.
Next, drag and drop the sub-folder MyObjcApp/MyObjcApp/Snowplow into your XCode project's workspace:
![]()
Make sure that the suggested options for adding Snowplow are set Create groups, then click Finish:
![]()
The tracker is dependent on FMDB version 2.3, an Objective-C wrapper around SQLite.
As before, git clone the dependency and copy the source into your XCode project's folder:
git clone https://github.com/ccgus/fmdb.git
cd fmdb && git checkout v2.3
cp -r src/fmdb ../MyObjcApp/MyObjcApp/
As before, drag and drop the sub-folder MyObjcApp/MyObjcApp/fmdb into your XCode project's workspace, making sure to Create groups.
Finally, you will need to edit Snowplow/SnowplowEmitter.m and Snowplow/SnowplowEventStore.m in X-Code and change:
#import <FMDB.h>to:
#import "FMDB.h"The tracker also depends on various frameworks:
$ grep 'frameworks' ../snowplow-objc-tracker/SnowplowTracker.podspec
s.ios.frameworks = 'CoreTelephony', 'UIKit', 'Foundation'
s.osx.frameworks = 'AppKit', 'Foundation'
Go to Target > General tab > Linked Frameworks and Libraries section and add:
- All of the frameworks for your target platform, as returned by the
grepabove libsqlite3.dylib
This is what adding the frameworks to an OS-X application looks like:
![]()
Until v0.4.0 of the tracker, you need to find all DLog(@ in the Snowplow sub-folder and replace with // DLog(@. You will have to manually comment out DLogs which span multiple lines.
Now Build your project and you should see Build Succeeded. If you get a build error, check that you added Snowplow and fmdb as Groups, not just as Folders.
You are now ready to proceed to instrumenting your app. Just remember to use quotation marks not angle brackets, and the Snowplow sub-folder as necessary when importing the tracker:
#import "SnowplowTracker.h"
#import "SnowplowEmitter.h"Home | About | Project | Setup Guide | Technical Docs | Copyright © 2012-2017 Snowplow Analytics Ltd
HOME » SNOWPLOW SETUP GUIDE » Step 2: Setup a Tracker
- Step 1: Setup a Collector
-
Step 2a: Setup a Tracker
- 2.1: Setup the ActionScript 3.0 Tracker
- 2.2: Setup the Android Tracker
- 2.3: Setup the Arduino Tracker
- 2.4: Setup the Golang Tracker
- 2.5: Setup the iOS Tracker
- 2.6: Setup the Java Tracker
- 2.7: Setup the JavaScript Tracker
- 2.8: Setup the Lua Tracker
- 2.9: Setup the .NET Tracker
- 2.10: Setup the Node.js Tracker
- 2.11: Setup the PHP Tracker
- 2.12: Setup the Pixel Tracker
- 2.13: Setup the Python Tracker
- 2.14: Setup the Ruby Tracker
- 2.15: Setup the Scala Tracker
- 2.16: Setup the Unity Tracker
- Step 2b: Setup a Webhook
- Step 2c: Setup a Data Store Source
- Step 3: Setup Enrich
- Step 4: Setup alternative data stores
- Step 5: Data modeling
- Step 6: Analyze your data!
Useful resources