Track notification events
Sendbird Business Messaging offers comprehensive tracking capabilities for both in-app messages and push notifications, extending the application of Business Messaging including the [Sequence] functionality.
Business Messaging allows you to track viewed
and clicked
events for in-app messages and delivered
and clicked
for push notifications.
In-app notifications
Viewed
When a user enters a channel after a new notification message arrives, it is considered viewed
. This event is crucial for tracking user engagement and interaction with messages. The methods below should be used when a message is viewed by a user.
Clicked
Click events are critical to track to gauge user interaction with the content. A message is marked as "clicked" when a user interacts with it, such as selecting a message or tapping a link or button within a message. The methods below should be used when a message is clicked and is considered to have been clicked by a user.
Push notifications
For the Business Messaging to accurately track push notifications, push notifications must be correctly set up in your mobile application. Sendbird provides detailed guides for configuring push notifications on both Android and iOS.
Set up environment for Android
To integrate push notifications with Sendbird on Android, follow the guide for setting up push notifications for Firebase Cloud Messaging (FCM). This setup includes creating a Firebase project, configuring your app with Firebase, adding Firebase configuration files to your project, and integrating FCM with the Sendbird SDK.
For a step-by-step guide, visit the Sendbird documentation: Set up push notifications for FCM.
This guide will walk you through the steps to ensure your Android application can receive and process push notifications, pivotal for tracking delivered and clicked events within your app.
Automatic Delivery Tracking with SendbirdPushHelper
Sendbird Android Chat SDK simplifies push notification handling by providing an interface that automatically sends a Push Delivered
event when an FCM push notification is received. This feature is facilitated through the SendbirdPushHelper
class, which allows for easy registration and handling of FCM messages within your Android application.
By utilizing the SendbirdPushHelper
, developers can streamline the process of tracking delivered notifications, as the SDK handles these events automatically, eliminating the need for manual implementation.
Register push handlers
To leverage automatic delivery tracking, you need to register a push handler. This functionality ensures that your application receives push notifications efficiently and tracks delivery status without additional code, enhancing the overall user experience and providing valuable engagement data.
Track delivered
For Android, the SendbirdPushHelper
class automatically sends push delivered status upon receiving an FCM push. There is no need for manual delivered status handling since SDK can support for multi-device push management.
Track clicked
Similar to in-app messages, tracking when a push notification is clicked provides insights into how users interact with notifications and which messages prompt action. Call the methods below when a push notification banner is clicked
You can hand over the data of RemoteMessage
received from the FCM to the Sendbird SDK.
Set up environment for iOS
For iOS, setting up push notifications involves registering your app with the Apple Push Notification service (APNs), configuring your app's notification settings, and integrating these settings with the Sendbird SDK. This process ensures your iOS app is prepared to handle push notifications, allowing for effective tracking within the Business Messaging feature.
Detailed instructions can be found in the Sendbird documentation: Register push notification credentials.
This comprehensive guide provides the steps to configure your iOS application to receive push notifications from APNs and how to communicate these notifications to the Sendbird servers for tracking purposes.
Track delivered
To mark a push notification as delivered when received, follow the instructions below:
- Initialize Sendbird Chat SDK.
-
Set the app group in
AppDelegate
. -
Implement the necessary method in the
NotificationServiceExtension
.
Track clicked
Similar to in-app messages, tracking when a push notification is clicked provides insights into how users interact with notifications and which messages prompt action. Call the methods below when a push notification banner is clicked
Implement the userNotificationCenter (_:didReceive:withCompletionHandler:)
method in AppDelegate
. This is called when a user clicks on a push notification.
If you implemented your app to receive sendbird push notifications in the foreground as well, please note the following. Sendbird SDK marks delivered
when receiving push notifications from AppDelegate
regardless of whether an app is in the foreground or background, so it can be delivered even if a user does not see the push banner. If the app can receive a push in the foreground but does not display it, please add a condition called markPushNotificationAsDelivered
method so that it does not deliver in the foreground.