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: customerKey, appName: appName)
* ObjC:
id<CATTrackerController> tracker = [CATAppAnalytics createTrackerWithCustomerKey:customerKey appName:appName];
customerKey - a string to identify specific customer account. Different keys shall be used for development / debug versus production environment. Find your keys on the account info page in Pulse.
appName - a string value used to distinguish your applications. Simple values that are unique across all of your integrated platforms work best here.
* Swift:
tracker?.subject?.userId = "user_id"
* ObjC:
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:
* Swift:
let data = "{\"identifier1\": \"test\",\"identifier2\": 1,\"identifier3\":true}"
tracker?.trackCustomEvent("your-event-name", data: data)
* ObjC:
NSString *data = @"{\"identifier1\": \"test\",\"identifier2\": 1,\"identifier3\":true}";
[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.
* Swift:
* //Add below property in view controller
* @objc var catViewId:String = "App Analytics View"
* ObjC:
* //Declare property like below
* @property(copy, nonatomic)NSString *catViewId;
* //Add below line in viewDidLoad method
* self.catViewId = @"Customizable name";
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.
* ObjC:
// 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",
};
[tracker setCustomTags:tags];
// Clear API
/**
* Clears all custom tags.
*/
- (void)clearCustomTags;
//Usage
[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" ];
[tracker clearCustomTags:keys];
* Swift:
//Usage: Set custom tags
let tags = ["Key1": "Value1", "Key2": "Value2"]
tracker?.setCustomTags(tags)
//Usage: Clear all custom tags
tracker?.clearCustomTags()
//Usage: Clear custom tags
let keys = ["Key1", "Key2", "Key3"]
tracker?.clearCustomTags(keys)
Event | Occurrence |
---|---|
network_request | after receiving the network request response |
screen_view | when the screen is interacted on either first launch or relaunch |
application_error | when an error occurrs in the application |
button_click | on the button click callback |
application_background | when the application is taken to the background |
application_foreground | when the application is taken to the foreground |
application_install | when the application is launched for the first time after it's installed. (It's not the exact installed time.) |
deep_link_received | on opening an application using the UTM URL |
To learn about the default metrics for analyzing the native and web applications performance, such as App Crashes, Avg Screen Load Time, and Page Loads, refer to the App Experience Metrics page in the Learning Center.
link |
Stars: 0 |
Last commit: 1 week ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics