RudderStack is a customer data pipeline tool for collecting, routing and processing data from your websites, apps, cloud tools, and data warehouse.
More information on RudderStack can be found here.
The RudderStack iOS SDK allows you to integrate RudderStack to your iOS application in order to track event data from your app. After integrating this SDK, you will also be able to send this data to your preferred analytics destination/s such as Google Analytics, Amplitude, and more, via RudderStack.
RudderStack is available through CocoaPods and Carthage.
To install it, simply add the following line to your Podfile:
pod 'Rudder', :git => 'https://github.com/feedloop/rudder-sdk-ios.git', :tag => 'v1.x.xx-feedloop'
And for Carthage support add the following line to your Cartfile
github "feedloop/rudder-sdk-ios" "v1.x.xx"
Remember to include the following code in all .m and .h files where you want to refer to or use Rudder SDK classes
#import <Rudder/Rudder.h>
To the initialize RSClient, put the following code in your AppDelegate.m file under the method didFinishLaunchingWithOptions:
RSConfigBuilder *builder = [[RSConfigBuilder alloc] init];
[builder withDataPlaneUrl:<DATA_PLANE_URL>];
[RSClient getInstance:<WRITE_KEY> config:[builder build]];
A shared instance of RSClient is accesible after the initialization by [RSClient sharedInstance].
[[RSClient sharedInstance] track:@"simple_track_event"];
[[RSClient sharedInstance] track:@"simple_track_with_props" properties:@{
@"key_1" : @"value_1",
@"key_2" : @"value_2"
}];
[[RSClient sharedInstance] screen:@"Main" properties:@{@"prop_key" : @"prop_value"}];
[[RSClient sharedInstance] identify:@"test_user_id"
traits:@{@"foo": @"bar",
@"foo1": @"bar1",
@"email": @"test@gmail.com"}
];
[[RSClient sharedInstance] group:@"sample_group_id"
traits:@{@"foo": @"bar",
@"foo1": @"bar1",
@"email": @"test@gmail.com"}
];
[[RSClient sharedInstance] alias:@"new_user_id"];
[[RSClient sharedInstance] reset];
For detailed documentation, check our documentation page.
If you come across any issues while configuring or using the RudderStack iOS SDK, please feel free to contact us or start a conversation on our Slack channel. We will be happy to help you.