We have recently refreshed our branding across our offerings and changed the names of our pricing plans. If you have signed up before Aug 9, 2021, please click Previous plans to view your applicable plans.
We assure you that this change will not impact your product experience, and no action is required on your part.
Freshchat mobile SDK allows you to listen to user actions and related meta properties.
This feature is available starting with the following SDK versions,
- Android: 2.7.0+
- iOS: 2.7.0+
Based on your platform, you can listen to user events as follows.
Android
Register for user events
We recommend you to register this in onCreate of your Application class.
IntentFilter userActionsIntentFilter = new IntentFilter(Freshchat.FRESHCHAT_EVENTS);
getLocalBroadcastManager().registerReceiver(receiver, userActionsIntentFilter);
BroadcastReceiver receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (intent == null || intent.getExtras() == null) {
return;
}
Event event = Freshchat.getEventFromBundle(intent.getExtras());
if (event != null) {
Log.d("Name", "Name : " + event.getEventName().getName());
Log.d("Prop", "Event Properties: " + event.getProperties());
}
}
};
Unregister for user events
You can unregister in onTerminate of your Application class.
getLocalBroadcastManager().unregisterReceiver(receiver);
Note: You can checkout our video on 'Tracking user events' here.
iOS
Objective C
Register for user events
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(userActionEvent:)
name:FRESHCHAT_EVENTS
object:nil];
- (void) userActionEvent:(NSNotification *)notif {
FreshchatEvent *fcEvent = notif.userInfo[@"event"];
// Check with available event enum
if (fcEvent.name == FCEventFAQOpen){
// Log existing event meta / properties
NSLog(@"Event properties - %@",fcEvent.properties);
}
}
Unregister for user events
[[NSNotificationCenter defaultCenter]removeObserver: FRESHCHAT_EVENTS];
Swift
Register for user events
NotificationCenter.default.addObserver(self,selector: #selector(userActionEvent(_:)),name: NSNotification.Name(rawValue: FRESHCHAT_EVENTS),object: nil)
func userActionEvent(_ notification: Notification)
{
var fcEvent : FreshchatEvent? = nil
fcEvent = (notification.userInfo?["event"] as? FreshchatEvent)
//Check with available event enum
if fcEvent?.name == FCEventFAQOpen {
//Log existing event meta / properties
print ("Event properties - \(String(describing: fcEvent?.properties))")
}
}
Unregister for user events
NotificationCenter.default.removeObserver(FRESHCHAT_EVENTS)
Supported Events
Event Name | Description |
FCEventFAQCategoryListOpen | When the FAQ category list is opened |
FCEventFAQListOpen | When FAQ list is opened |
FCEventFAQOpen | When FAQ is opened |
FCEventFAQSearch | When FAQ is selected from search result or search results canceled |
FCEventFAQVote | When FAQ is voted |
FCEventChannelListOpen | When the Topics list is opened |
FCEventMessageSent | When a user message is sent |
FCEventConversationOpen | When a Topic is opened |
FCEventCsatOpen | When CSAT is shown to the user |
FCEventCsatSubmit | When a user responds to a CSAT |
FCEventCsatExpiry | When CSAT expires and is not shown to the user |
FCEventLinkTap | When a user clicks an external link |
FCEventScreenView | When Freshchat SDK screen is visible to the user |
FCEventMessageReceive | When a user receives a message |
FCEventNotificationReceive | When a user receives a Freshchat notification |
FCEventIdTokenStatusChange | When a user's JWT token status changes |
FCEventDropDownShow | When a drop-down message is shown to the user |
FCEventDropDownOptionSelect | When a drop-down option is selected by the user |
FCEventCarouselShow | When a carousel message is shown to the user |
FCEventCarouselOptionSelect | When a carousel option is selected by the user |
FCEventCarouselOptionView | When a carousel view button is clicked by the user |
FCEventCalendarFindTimeSlotClick | When a user clicks on the Find a slot button |
FCEventCalendarInviteCancel | When a user cancels a meeting invite |
FCEventCalendarNoTimeSlotFound | When no meeting invites are available |
FCEventCalendarBookingSuccess | When a user successfully books a meeting |
FCEventCalendarBookingRetry | When a user retries booking a meeting |
FCEventCalendarBookingFailure | When user meeting booking has failed |
FCEventShowOriginalClick | When a user clicks on the live translations toggle button to see the agent’s original message |
FCEventHideOriginalClick | When a user clicks on the live translations toggle button to hide the agent’s original message |