Skip to content

Latest commit

 

History

History
100 lines (68 loc) · 2.84 KB

README.md

File metadata and controls

100 lines (68 loc) · 2.84 KB

Version

RudderStack iOS SDK

RudderStack's iOS SDK lets you track event data from your iOS applications. After integrating the SDK, you will be able to send the event data to your preferred destination/s such as Google Analytics, Amplitude, and more.

For detailed documentation on the iOS SDK, click here.

Installing the iOS SDK

The iOS SDK is available through CocoaPods and Carthage.

CocoaPods

To install the SDK, simply add the following line to your Podfile:

pod 'Rudder', '1.0.24'

Carthage

For Carthage support, add the following line to your Cartfile:

github "rudderlabs/rudder-sdk-ios" "v1.0.24"

Remember to include the following code in all .m and .h files where you want to refer to or use the RudderStack SDK classes, as shown:

#import <Rudder/Rudder.h>

Initializing the RudderStack client

To the initialize RSClient, place 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].

Sending Events

Track

[[RSClient sharedInstance] track:@"simple_track_event"];
[[RSClient sharedInstance] track:@"simple_track_with_props" properties:@{
    @"key_1" : @"value_1",
    @"key_2" : @"value_2"
}];

Screen

[[RSClient sharedInstance] screen:@"Main" properties:@{@"prop_key" : @"prop_value"}];

Identify

[[RSClient sharedInstance] identify:@"test_user_id"
                             traits:@{@"foo": @"bar",
                                      @"foo1": @"bar1",
                                      @"email": @"[email protected]"}
];

Group

[[RSClient sharedInstance] group:@"sample_group_id"
                          traits:@{@"foo": @"bar",
                                   @"foo1": @"bar1",
                                   @"email": @"[email protected]"}
];

Alias

[[RSClient sharedInstance] alias:@"new_user_id"];

Reset

[[RSClient sharedInstance] reset];

For detailed documentation, click here.

Contact us

For more information on using the RudderStack iOS SDK, you can contact us or start a conversation on our Slack channel.