Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RUM Enforced usage attribution at the org level #27565

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,32 @@ further_reading:
text: 'Plan and Usage Settings'
---

{{< callout url="#" btn_hidden="true" header="false">}}
<a href="/real_user_monitoring/guide/tracking-rum-usage-with-usage-attribution-tags/#enforce-tags-to-be-set-at-the-org-level">Enforced RUM Usage Attribution</a> at the organization level is in Preview. To request access, contact <a href="https://docs.datadoghq.com/help/"> Datadog Support</a>.
{{< /callout >}}

## Overview

The [Usage Attribution][1] page provides information and functionality related to data usage and usage types. By default, the data usage can be viewed and filtered by broader categories such as product, organization, or tag keys. This guide describes how to configure RUM usage attribution so it can be viewed by custom categories on the Usage Attribution page (accurate to +/- 20% of the actual value). This can help you track RUM sessions and costs for different departments, products, or other categories, instead of viewing a single aggregate number.
The [Usage Attribution][1] page provides information and functionality related to data usage and usage types. By default, the data usage can be viewed and filtered by broader categories such as product, organization, or tag keys. You can define up to three usage attribution tags per organization and manage them directly from the UI for each RUM application.

This guide describes how to do the following:

- Configure RUM usage attribution so it can be viewed by custom categories on the Usage Attribution page (accurate to +/- 20% of the actual value). This can help you track RUM sessions and costs for different departments, products, or other categories, instead of viewing a single aggregate number.
- Enforce tags to be set at the organization level (recommended).

As an example, this guide walks through how to track RUM usage by department.

## Set up RUM usage attribution

You can set up RUM usage attribution tags at the SDK level.

### Check your tags

Categories for usage are determined by tags. Before setting up your RUM usage attribution, make sure that the tags you want to use are configured on the Usage Attribution page. Click **Edit tags**, then select the tags that you want to use to view usage and click **Save**. In this example, we've added "department" as a tag.

{{< img src="real_user_monitoring/guide/rum-usage-attribution-tags/rum-use-attribution-tags-1.jpeg" alt="Check your tags on the Usage Attribution page" style="width:100%;">}}

### Add tags to your RUM sessions
Once your usage attribution tags have been configured, you can tag your RUM sessions with them.

To set tags for **browser sessions**, set the RUM global context at the start of the session (right after calling `datadogRum.init`) using the [`setGlobalContextProperty`][2] method. For example, here's how we would tag sessions so they can be tracked for the marketing department:
To set tags for **browser sessions**, set the RUM global context at the start of the session (right after calling `datadogRum.init`) using the [`setGlobalContextProperty`][3] method. For example, here's how we would tag sessions so they can be tracked for the marketing department:
rtrieu marked this conversation as resolved.
Show resolved Hide resolved

```javascript
datadogRum.setGlobalContextProperty('department', 'marketing');
Expand All @@ -46,21 +54,51 @@ RumMonitor.shared().addAttribute(forKey: "department", value: "marketing")

**Note**: A few tags are included by default (`service`, `env`, `version`, `application.id`, and `application.name`). For anything else, set the global context using the method above.

Once you've deployed this step, new RUM sessions are tracked according to the tags you added.
After you've deployed this step, new RUM sessions are tracked according to the tags you added.

## View RUM usage
The newly tagged sessions are displayed on the [Usage Attribution][3] page. When you review the RUM with Session Replay Sessions and RUM Sessions columns, you can see the number of sessions by department.
The newly tagged sessions are displayed on the [Usage Attribution][1] page. When you review the RUM with Session Replay Sessions and RUM Sessions columns, you can see the number of sessions by department.

{{< img src="real_user_monitoring/guide/rum-usage-attribution-tags/rum-use-attribution-tags-3.png" alt="View RUM usage by department" style="width:100%;">}}

Usage information is also available through the [`GetHourlyUsageAttribution`][4] endpoint.
Usage information is also available through the [`GetHourlyUsageAttribution`][5] endpoint.

## Enforce tags to be set at the org level

{{< callout url="#" btn_hidden="true" header="false">}}
Enforced RUM Usage Attribution is in Preview. To request access, contact <a href="https://docs.datadoghq.com/help/"> Datadog Support</a>.
{{< /callout >}}

You can require that a usage attribution tag gets added to a RUM application so that you can understand how its usage contributes to your Datadog bill. When this setting is active, usage attribution tags are required to be set when creating a new RUM application or updating an existing RUM application in Datadog per organization.

If your Datadog environment has a parent and child organization and the setting is enforced in both organizations, you are required to set attribution tags for both. For example, if three attribution tags are required for the parent org and two attribution tags are required for the child org, you are prompted to set a total of five tags for each of your applications.

1. Ensure you have the RUM Settings Write permission.
2. Navigate to [**Digital Experience** > **Real User Monitoring** > **Manage Applications** > **Enforce Usage Attribution**][6].
rtrieu marked this conversation as resolved.
Show resolved Hide resolved
rtrieu marked this conversation as resolved.
Show resolved Hide resolved
3. Click the toggle to **Enforce tags for usage attribution on all applications**. With this enabled, apps can only be created or updated if all tags are set.

{{< img src="real_user_monitoring/guide/rum-usage-attribution-tags/enforce-usage-attribution-toggle-1.png" alt="Toggle the Enforce Usage Attribution Tags setting at the application level." style="width:100%;">}}

### Manage usage attribution tags for your RUM applications
After your usage attribution tags have been enforced and configured, you can tag your RUM sessions with them.

To manage usage attribution tags to your application in the UI:

1. Go to the [RUM Application Management][2] page.
2. When creating a new application or updating one, you can see how many of the required tags have been added.
3. Click **Edit tags** to assign the [configured usage attribution tags][7].
rtrieu marked this conversation as resolved.
Show resolved Hide resolved
4. Click **Save Changes**.

{{< img src="real_user_monitoring/guide/rum-usage-attribution-tags/enforce-usage-attribution-tags.png" alt="Prompt to add required usage attribution tags after enforcing the tags." style="width:60%;">}}

## Further reading

{{< partial name="whats-next/whats-next.html" >}}

[1]: https://app.datadoghq.com/billing/usage-attribution
[2]: /real_user_monitoring/browser/advanced_configuration/?tab=npm#global-context
[3]: https://app.datadoghq.com/billing/usage-attribution
[2]: https://app.datadoghq.com/rum/list
[3]: /real_user_monitoring/browser/advanced_configuration/?tab=npm#global-context
[4]: /api/latest/usage-metering/#get-hourly-usage-attribution-v1
[5]: /real_user_monitoring/mobile_and_tv_monitoring/android/advanced_configuration/?tab=kotlin#track-attributes
[6]: https://app.datadoghq.com/rum/enforce-usage-attribution-tags
rtrieu marked this conversation as resolved.
Show resolved Hide resolved
[7]: /real_user_monitoring/guide/tracking-rum-usage-with-usage-attribution-tags/#check-your-tags
rtrieu marked this conversation as resolved.
Show resolved Hide resolved
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading