---
schema_version: "1"
id: 2f05b4cd5e4c7407a7f74acf91c0ea2c28de982b70aa9c63f1f2db61a86ccfbd
title: Analytics with the Service Chat SDK for Android
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/service-cloud/service-sdk-android/guides/android-analytics.md
canonical_url: https://developer.salesforce.com/docs/service/service-sdk-android/guide/android-analytics.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 7824fbc15e3535baf998d363a0851025cd05461d700acc71fe09c5f0a5fb5430
products:
  - Embedded Service Chat SDK for Android Developer Guide
  - Service Cloud Developer Content
---

# Analytics with the Service Chat SDK for Android

You can listen to user-driven events from the Service Chat SDK using the `ServiceAnalytics` system.

**important:** The legacy chat product is scheduled for retirement on February 14, 2026, and is in maintenance mode until then. During this phase, you can continue to use chat, but we no longer recommend that you implement new chat channels. To avoid service interruptions to your customers, migrate to [Messaging for In-App and Web](https://help.salesforce.com/s/articleView?id=service.miaw_intro_landing.htm&type=5) before that date. Messaging offers many of the [chat features](https://help.salesforce.com/s/articleView?id=service.miaw_chat_vs_messaging.htm&type=5) that you love plus asynchronous conversations that can be picked back up at any time. Learn about chat retirement in [Help](https://help.salesforce.com/s/articleView?id=001790618&type=1).

Implement [`ServiceAnalyticsListener`](https://forcedotcom.github.io/ServiceSDK-Android/releases/common/8.0.5/api/reference/com/salesforce/android/service/common/analytics/ServiceAnalyticsListener.html) and add your listener to [`ServiceAnalytics`](https://forcedotcom.github.io/ServiceSDK-Android/releases/common/8.0.5/api/reference/com/salesforce/android/service/common/analytics/ServiceAnalytics.html) to start receiving events.

In Java:

```java
ServiceAnalytics.addListener(new ServiceAnalyticsListener() {
  @Override public void onServiceAnalyticsEvent(String behaviorId,
                                                Map<String, Object> eventData) {
    // TO DO: Do something with analytics data
  }
});
```

In Kotlin:

```java
ServiceAnalytics.addListener { behaviorId, eventData ->
  // TO DO: Do something with analytics data
}
```

When you receive an event, inspect the `behaviorId` to see the behavior that caused the event (for example, `KNOWLEDGE_UI_USER_LAUNCH`). Inspect the `eventData` map for contextual data related to the event (for example, `KnowledgeUIAnalytics.DATA_CATEGORY_GROUP_NAME`).

For a list of behaviors and the key constants for parsing the `eventData` map, see the analytics class for the desired feature.

- Knowledge Analytics

  - : [`KnowledgeUIAnalytics`](https://forcedotcom.github.io/ServiceSDK-Android/releases/knowledge/4.3.6/api/reference/com/salesforce/android/knowledge/ui/KnowledgeUIAnalytics.html)

- Case Management Analytics

  - : [`CasesUIAnalytics`](https://forcedotcom.github.io/ServiceSDK-Android/releases/case/4.2.7/api/reference/com/salesforce/android/cases/ui/CasesUIAnalytics.html)

- Chat Analytics

  - : [`ChatAnalytics`](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/core/ChatAnalytics.html)
