Tracking UX Events
Tracking events
Using Habit Analytics SDK you can track UX events in your app. They can be used to gather information on UX experience, application flow or any other scenario you desire. To track an event all you need to do is call the track method like this:
HabitAnalytics.shared.track(eventName: String, properties: [String: SupportedType]?);
Event properties can be used to complement the event with additional details. They are optional and the currently supported types can be seen in the following examples:
No properties
HabitAnalytics.shared.track(eventName: 'ButtonX tapped');
HabitAnalytics.shared.track(eventName: 'NavigatedTo PageY');
String
HabitAnalytics.shared.track(eventName: 'User sign in', properties: {'type':'email'});
Numeric
HabitAnalytics.shared.track(eventName: 'Application started', properties: {'Loading Time':0.9 });
Boolean
HabitAnalytics.shared.track(eventName: 'User sign in', properties: {'First time': true });
Date
HabitAnalytics.shared.track(eventName: 'User sign in', properties: {'Date': Date() });
URL
HabitAnalytics.shared.track(eventName: 'Clicked URL', properties: {'url': URL });
List
HabitAnalytics.shared.track(eventName: 'Favorite Cities', properties: {'Places selected': ["Lisbon", "New York", "London"] });
Last updated
Was this helpful?