From c15314cde253241385944a73d965f3196487d566 Mon Sep 17 00:00:00 2001 From: "quentin.sellem" Date: Fri, 21 Aug 2026 13:23:59 +0200 Subject: [PATCH] RUM: document account.* attributes for mobile SDKs The account APIs (setAccountInfo / addAccountExtraInfo / clearAccountInfo) shipped in the mobile SDKs in June 2025 but were only documented for the Browser SDK. Add a "Track user accounts" section, mirroring the Browser page's Account section, to the Advanced Configuration partials for the platforms whose SDKs expose the API: - iOS (2.29.0), Android (2.23.0), Flutter (2.12.0), React Native (3.0.0), Kotlin Multiplatform (1.2.0) Also: - MAUI already documented the API; add the missing attribute table and align the heading with the other platforms. - C++ documented the attributes as `acc.id` / `acc.name`, but the SDK serializes an `account` object, so the queryable attributes are `account.id` / `account.name`. Corrected. Unity and Roku expose no account API, so they are unchanged. Co-Authored-By: Claude Opus 5 (1M context) --- .../en/sdk/advanced_config/android.mdoc.md | 41 +++++++++++++ .../mdoc/en/sdk/advanced_config/cpp.mdoc.md | 4 +- .../en/sdk/advanced_config/flutter.mdoc.md | 49 ++++++++++++++++ .../mdoc/en/sdk/advanced_config/ios.mdoc.md | 58 +++++++++++++++++++ .../kotlin_multiplatform.mdoc.md | 41 +++++++++++++ .../mdoc/en/sdk/advanced_config/maui.mdoc.md | 9 ++- .../sdk/advanced_config/react_native.mdoc.md | 49 ++++++++++++++++ 7 files changed, 248 insertions(+), 3 deletions(-) diff --git a/hugo/layouts/shortcodes/mdoc/en/sdk/advanced_config/android.mdoc.md b/hugo/layouts/shortcodes/mdoc/en/sdk/advanced_config/android.mdoc.md index 383e57aaa5e..f3d39831383 100644 --- a/hugo/layouts/shortcodes/mdoc/en/sdk/advanced_config/android.mdoc.md +++ b/hugo/layouts/shortcodes/mdoc/en/sdk/advanced_config/android.mdoc.md @@ -286,6 +286,47 @@ To identify user sessions, use the `setUserInfo` API, for example: Datadog.setUserInfo('1234', 'John Doe', 'john@doe.com') ``` +### Track user accounts + +If your application is used by organizations, workspaces, or tenants, add account information to your RUM sessions to: + +* Analyze performance and errors by account +* Know which accounts are the most impacted by an issue +* Prioritize fixes based on account value + +Account information is set alongside user information, not instead of it. + +| Attribute | Type | Description | +| -------------- | ------ | ----------------------------------------------------------- | +| `account.id` | String | (Required) Unique account identifier. | +| `account.name` | String | (Optional) Account friendly name, displayed in the RUM UI. | + +To identify accounts, use the `setAccountInfo` API, for example: + +```kotlin +Datadog.setAccountInfo("acct-1234", "Acme Corp", mapOf("tier" to "enterprise")) +``` + +Keys passed in `extraInfo` are added to the `account` attribute, so `tier` is reported as `account.tier`. + +To append attributes to the account you already set, use `addAccountExtraInfo`. Call `setAccountInfo` first: adding extra info before an account exists has no effect. + +```kotlin +Datadog.addAccountExtraInfo(mapOf("seats" to 42)) +``` + +To clear the account (for example, when the user signs out), use `clearAccountInfo`. + +```kotlin +Datadog.clearAccountInfo() +``` + +Account information is attached to RUM events, logs, traces, and crash reports. + +{% alert level="info" %} +Clearing the account empties the `account` attribute on the active session and the active view. To retain the account on data already collected, stop the session with `GlobalRumMonitor.get().stopSession()` or the view with `GlobalRumMonitor.get().stopView()` before clearing. +{% /alert %} + ### Track attributes ```kotlin diff --git a/hugo/layouts/shortcodes/mdoc/en/sdk/advanced_config/cpp.mdoc.md b/hugo/layouts/shortcodes/mdoc/en/sdk/advanced_config/cpp.mdoc.md index 4aa0bc2d8c5..35ac9255189 100644 --- a/hugo/layouts/shortcodes/mdoc/en/sdk/advanced_config/cpp.mdoc.md +++ b/hugo/layouts/shortcodes/mdoc/en/sdk/advanced_config/cpp.mdoc.md @@ -322,8 +322,8 @@ A parallel API is available for associating an account (such as an organization, | Attribute | Type | Description | | --- | --- | --- | -| `acc.id` | String | (Required) Unique account identifier. | -| `acc.name` | String | (Optional) Account name, displayed in the Datadog UI. | +| `account.id` | String | (Required) Unique account identifier. | +| `account.name` | String | (Optional) Account name, displayed in the Datadog UI. | {% tabs %} {% tab label="C++" %} diff --git a/hugo/layouts/shortcodes/mdoc/en/sdk/advanced_config/flutter.mdoc.md b/hugo/layouts/shortcodes/mdoc/en/sdk/advanced_config/flutter.mdoc.md index e7464a5b023..05746accea6 100644 --- a/hugo/layouts/shortcodes/mdoc/en/sdk/advanced_config/flutter.mdoc.md +++ b/hugo/layouts/shortcodes/mdoc/en/sdk/advanced_config/flutter.mdoc.md @@ -392,6 +392,55 @@ DatadogSdk.instance.addUserExtraInfo({ }); ``` +### Track user accounts + +If your application is used by organizations, workspaces, or tenants, add account information to your RUM sessions to: + +* Analyze performance and errors by account +* Know which accounts are the most impacted by an issue +* Prioritize fixes based on account value + +Account information is set alongside user information, not instead of it. + +| Attribute | Type | Description | +| -------------- | ------ | ----------------------------------------------------------- | +| `account.id` | String | (Required) Unique account identifier. | +| `account.name` | String | (Optional) Account friendly name, displayed in the RUM UI. | + +To identify accounts, use `DatadogSdk.setAccountInfo`. + +For example: + +```dart +DatadogSdk.instance.setAccountInfo( + id: 'acct-1234', + name: 'Acme Corp', + extraInfo: {'tier': 'enterprise'}, +); +``` + +Keys passed in `extraInfo` are added to the `account` attribute, so `tier` is reported as `account.tier`. + +To append attributes to the account you already set, use `addAccountExtraInfo`. Call `setAccountInfo` first: adding extra info before an account exists has no effect. To remove an existing attribute, set it to `null`. + +```dart +DatadogSdk.instance.addAccountExtraInfo({ + 'seats': 42, +}); +``` + +To clear the account (for example, when the user signs out), use `clearAccountInfo`. + +```dart +DatadogSdk.instance.clearAccountInfo(); +``` + +Account information is attached to RUM events, logs, and traces. + +{% alert level="info" %} +Clearing the account empties the `account` attribute on the active session and the active view. To retain the account on data already collected, stop the session with `DatadogRum.stopSession` or the view with `DatadogRum.stopView` before clearing. +{% /alert %} + ## Clear all data Use `clearAllData` to clear all data that has not been sent to Datadog. diff --git a/hugo/layouts/shortcodes/mdoc/en/sdk/advanced_config/ios.mdoc.md b/hugo/layouts/shortcodes/mdoc/en/sdk/advanced_config/ios.mdoc.md index 92095626183..16871615bc9 100644 --- a/hugo/layouts/shortcodes/mdoc/en/sdk/advanced_config/ios.mdoc.md +++ b/hugo/layouts/shortcodes/mdoc/en/sdk/advanced_config/ios.mdoc.md @@ -250,6 +250,64 @@ Datadog.setUserInfo(id: "1234", name: "John Doe", email: "john@doe.com") {% /tab %} {% /tabs %} +### Track user accounts + +If your application is used by organizations, workspaces, or tenants, add account information to your RUM sessions to: + +* Analyze performance and errors by account +* Know which accounts are the most impacted by an issue +* Prioritize fixes based on account value + +Account information is set alongside user information, not instead of it. + +| Attribute | Type | Description | +| -------------- | ------ | ----------------------------------------------------------- | +| `account.id` | String | (Required) Unique account identifier. | +| `account.name` | String | (Optional) Account friendly name, displayed in the RUM UI. | + +To identify accounts, use the `Datadog.setAccountInfo(id:name:extraInfo:)` API. + +For example: + +{% tabs %} +{% tab label="Swift" %} + +```swift +import DatadogCore + +Datadog.setAccountInfo(id: "acct-1234", name: "Acme Corp", extraInfo: ["tier": "enterprise"]) +``` + +{% /tab %} +{% tab label="Objective-C" %} + +```objective-c +[DDDatadog setAccountInfoWithAccountId:@"acct-1234" name:@"Acme Corp" extraInfo:@{@"tier": @"enterprise"}]; +``` + +{% /tab %} +{% /tabs %} + +Keys passed in `extraInfo` are added to the `account` attribute, so `tier` is reported as `account.tier`. + +To append attributes to the account you already set, use `Datadog.addAccountExtraInfo(_:)`. Call `Datadog.setAccountInfo(id:name:extraInfo:)` first: adding extra info before an account exists has no effect. + +```swift +Datadog.addAccountExtraInfo(["seats": 42]) +``` + +To clear the account (for example, when the user signs out), use `Datadog.clearAccountInfo()`. + +```swift +Datadog.clearAccountInfo() +``` + +Account information is attached to RUM events, logs, traces, and crash reports. + +{% alert level="info" %} +Clearing the account empties the `account` attribute on the active session and the active view. To retain the account on data already collected, stop the session with `RUMMonitor.stopSession()` or the view with `stopView(viewController:attributes:)` before clearing. +{% /alert %} + ## Track background events {% alert level="info" %} diff --git a/hugo/layouts/shortcodes/mdoc/en/sdk/advanced_config/kotlin_multiplatform.mdoc.md b/hugo/layouts/shortcodes/mdoc/en/sdk/advanced_config/kotlin_multiplatform.mdoc.md index 6d7845d6e8f..addd328e7d1 100644 --- a/hugo/layouts/shortcodes/mdoc/en/sdk/advanced_config/kotlin_multiplatform.mdoc.md +++ b/hugo/layouts/shortcodes/mdoc/en/sdk/advanced_config/kotlin_multiplatform.mdoc.md @@ -163,6 +163,47 @@ To identify user sessions, use the `setUserInfo` API, for example: Datadog.setUserInfo('1234', 'John Doe', 'john@doe.com') ``` +### Track user accounts + +If your application is used by organizations, workspaces, or tenants, add account information to your RUM sessions to: + +* Analyze performance and errors by account +* Know which accounts are the most impacted by an issue +* Prioritize fixes based on account value + +Account information is set alongside user information, not instead of it. + +| Attribute | Type | Description | +| -------------- | ------ | ----------------------------------------------------------- | +| `account.id` | String | (Required) Unique account identifier. | +| `account.name` | String | (Optional) Account friendly name, displayed in the RUM UI. | + +To identify accounts, use the `setAccountInfo` API, for example: + +```kotlin +Datadog.setAccountInfo("acct-1234", "Acme Corp", mapOf("tier" to "enterprise")) +``` + +Keys passed in `extraInfo` are added to the `account` attribute, so `tier` is reported as `account.tier`. + +To append attributes to the account you already set, use `addAccountExtraInfo`. Call `setAccountInfo` first: adding extra info before an account exists has no effect. + +```kotlin +Datadog.addAccountExtraInfo(mapOf("seats" to 42)) +``` + +To clear the account (for example, when the user signs out), use `clearAccountInfo`. + +```kotlin +Datadog.clearAccountInfo() +``` + +Account information is attached to RUM events and logs. + +{% alert level="info" %} +Clearing the account empties the `account` attribute on the active session and the active view. To retain the account on data already collected, stop the session with `GlobalRumMonitor.get().stopSession()` or the view with `GlobalRumMonitor.get().stopView()` before clearing. +{% /alert %} + ### Track attributes ```kotlin diff --git a/hugo/layouts/shortcodes/mdoc/en/sdk/advanced_config/maui.mdoc.md b/hugo/layouts/shortcodes/mdoc/en/sdk/advanced_config/maui.mdoc.md index e8591751794..7baa24dc3f7 100644 --- a/hugo/layouts/shortcodes/mdoc/en/sdk/advanced_config/maui.mdoc.md +++ b/hugo/layouts/shortcodes/mdoc/en/sdk/advanced_config/maui.mdoc.md @@ -143,10 +143,15 @@ DdSdk.AddUserExtraInfo(new Dictionary { { "subscription", "annua DdSdk.ClearUserInfo(); ``` -### Track account sessions +### Track user accounts For B2B applications, `DdSdk.SetAccountInfo` attaches an account identity to every event. Use it together with — not instead of — user info. +| Attribute | Type | Description | +| -------------- | ------ | ----------------------------------------------------------- | +| `account.id` | String | (Required) Unique account identifier. | +| `account.name` | String | (Optional) Account friendly name, displayed in the RUM UI. | + ```csharp DdSdk.SetAccountInfo("acct-456", "Acme Corp", new Dictionary { { "tier", "enterprise" } }); @@ -156,6 +161,8 @@ DdSdk.AddAccountExtraInfo(new Dictionary { { "region", "us-east" DdSdk.ClearAccountInfo(); ``` +Keys passed in the extra info dictionary are added to the `account` attribute, so `tier` is reported as `account.tier`. Call `SetAccountInfo` before `AddAccountExtraInfo`: adding extra info before an account exists has no effect. + ### Track global attributes Global attributes are attached to every RUM, Log, and Trace event the SDK emits. diff --git a/hugo/layouts/shortcodes/mdoc/en/sdk/advanced_config/react_native.mdoc.md b/hugo/layouts/shortcodes/mdoc/en/sdk/advanced_config/react_native.mdoc.md index f9a79b8feb7..7071378e4fe 100644 --- a/hugo/layouts/shortcodes/mdoc/en/sdk/advanced_config/react_native.mdoc.md +++ b/hugo/layouts/shortcodes/mdoc/en/sdk/advanced_config/react_native.mdoc.md @@ -440,6 +440,55 @@ If you want to clear the user information (for example, when the user signs out) DdSdkReactNative.clearUserInfo(); ``` +### Track user accounts + +If your application is used by organizations, workspaces, or tenants, add account information to your RUM sessions to: + +* Analyze performance and errors by account +* Know which accounts are the most impacted by an issue +* Prioritize fixes based on account value + +Account information is set alongside user information, not instead of it. + +| Attribute | Type | Description | +| -------------- | ------ | ----------------------------------------------------------- | +| `account.id` | String | (Required) Unique account identifier. | +| `account.name` | String | (Optional) Account friendly name, displayed in the RUM UI. | + +To identify accounts, use the `setAccountInfo` API, for example: + +```js +DdSdkReactNative.setAccountInfo({ + id: 'acct-1234', + name: 'Acme Corp', + extraInfo: { + tier: 'enterprise' + } +}); +``` + +Keys passed in `extraInfo` are added to the `account` attribute, so `tier` is reported as `account.tier`. + +If you want to add or update account information, use the `addAccountExtraInfo` API. Call `setAccountInfo` first: adding extra info before an account exists is skipped and logs a warning. + +```js +DdSdkReactNative.addAccountExtraInfo({ + seats: 42 +}); +``` + +If you want to clear the account information (for example, when the user signs out), you can do so by calling the `clearAccountInfo` API: + +```js +DdSdkReactNative.clearAccountInfo(); +``` + +Account information is attached to RUM events, logs, and traces. + +{% alert level="info" %} +Clearing the account empties the `account` attribute on the active session and the active view. To retain the account on data already collected, stop the session or the view before clearing. +{% /alert %} + ### Global attributes You can keep global attributes to track information about a specific session, such as A/B testing configuration, ad campaign origin, or cart status. These attributes are attached to all future Logs, Spans, and RUM events.