iOS
Requirements
- Edit permission to your iOS source code to modify the code.
- iOS development environment is setup.
Use Cases
- Track user identity and behavior on your iOS mobile applications.
Guideline
Installation
Add filum-ios-sdk as a submodule
Add filum-ios-sdk as a submodule to your local git repo like so:
git submodule add git@github.com:Filum-AI/filum-ios-sdk.git
Instal via CocoaPods
Inside your Podfile:
pod 'FilumBDP', :path => './filum-ios-sdk'
path should point to the filum-ios-sdk submodule
Finally, run this command to make FilumBDP available inside your project:
pod install
Usage
Integrate
Import the header file
#import <FilumBDP/FilumBDP.h>
Import FilumBDP
Initialize the library
[FilumBDP initWithToken:@"INSERT_YOUR_WRITE_KEY_HERE" serverUrl:[NSURL URLWithString:@"INSERT_THE_EVENT_API_URL_HERE"]];
FilumBDP.initWithToken("INSERT_YOUR_WRITE_KEY_HERE", serverUrl: URL(string: "INSERT_THE_EVENT_API_URL_HERE"))
Identify
Use this method right after user has been authenticated or user info has been updated. properties can be nil.
Objective-C
[[FilumBDP sharedInstance] identify:@"INSERT THE USER ID"] [[FilumBDP sharedInstance] identify:@"INSERT THE USER ID" properties:@{ @"Name": Harry Potter }];
Swift
FilumBDP.sharedInstance().identify("INSERT THE USER ID") FilumBDP.sharedInstance().identify("INSERT THE USER ID", properties: { "Name": "Harry Potter" })
Track
Use a string to represent the event name and a dictionary to represent the event properties. properties can be nil.
Objective-C
[[FilumBDP sharedInstance] track:@"Purchase"] [[FilumBDP sharedInstance] track:@"Transaction Completed" properties:@{ @"Transaction ID": transactionId }];
Swift
FilumBDP.sharedInstance().track("Purchase") FilumBDP.sharedInstance().track("Transaction Completed", properties: { "Transaction ID": transactionId })
Reset
Use this method right after user has just logged out
Objective-C
[[FilumBDP sharedInstance] reset];
Swift
FilumBDP.sharedInstance().reset()