Use Application Analytics to autocollect events and track application specific events and state changes.
SPM
Cocoapods
Manual Download
Link the following system frameworks to Link Binary with Libraries section in xcode:
//Swift
import ConvivaAppAnalytics
//Objc
@import ConvivaAppAnalytics;
//Swift
var tracker = CATAppAnalytics.createTracker(customerKey: "<YOUR_CUSTOMER_KEY_ADVISED_BY_Conviva>", appName: "<YOUR_APP_NAME_ADVISED_BY_Conviva>")
//ObjC
CATTrackerController *tracker = [CATAppAnalytics createTrackerWithCustomerKey:@"<YOUR_CUSTOMER_KEY_ADVISED_BY_Conviva>" appName:@"<YOUR_APP_NAME_ADVISED_BY_Conviva>"];
tracker.subject.userId = @"user_id";
Use trackCustomEvent() to track all kinds of events. This API provides 2 fields to describe the tracked events.
The following example shows the implementation of the 'onClick' event listener to any element:
let data = "{\"identifier1\": \"test\",\"identifier2\": 1,\"identifier3\":true}"
self.tracker.trackCustomEvent("your-event-name", data: data);
When user navigates between screens, user journey is tracked by reading the class names of UIViewController classes. Name of the screens can be customized using below code as per the bussiness needs.
* ObjC:
* //Declare property like below
* @property(copy, nonatomic)NSString *catViewId;
* //Add below line in viewDidLoad method
* self.catViewId = @“Customizable name”;
* Swift:
* //Add below property in view controller
* @objc var catViewId:String = “App Analytics View”
Support is added to pass custom data as key-val pairs which are available in each event triggered by sdk and passed to backend. Below are the new api additions to support Custom Tags.
// Setter API
/**
* Set custom tags.
* Pass custom tags
* @param tags Dictionary of Key-Val pairs.
*/
- (void)setCustomTags:(NSDictionary *)tags;
// Usage
NSDictionary* tags = @{
@"Key1": @"Value1",
@"Key2": @"Value2",
};
[self.tracker setCustomTags:tags];
// Clear API
/**
* Clears all custom tags.
*/
- (void)clearCustomTags;
// Usage
[self.tracker clearCustomTags];
/**
* Clears custom tags which are matching keys as passed in.
* Keys of tags to be cleared
* @param tagKeys tagKeys.
*/
- (void)clearCustomTags:(NSArray *)tagKeys;
// Usage
NSArray* keys = @[ @"Key1", @"Key2", @"Key3" ];
[self.tracker clearCustomTags:keys];
link |
Stars: 0 |
Last commit: 6 days ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics