Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++" %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
58 changes: 58 additions & 0 deletions hugo/layouts/shortcodes/mdoc/en/sdk/advanced_config/ios.mdoc.md
Original file line number Diff line number Diff line change
Expand Up @@ -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" %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,15 @@ DdSdk.AddUserExtraInfo(new Dictionary<string, object> { { "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<string, object> { { "tier", "enterprise" } });
Expand All @@ -156,6 +161,8 @@ DdSdk.AddAccountExtraInfo(new Dictionary<string, object> { { "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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading