Track RUM Usage with Usage Attribution Tags
Overview
The Usage Attribution 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.
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.
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
method. For example, here’s how you could tag sessions so they can be tracked for the marketing department:
datadogRum.setGlobalContextProperty('department', 'marketing');
To set tags for mobile sessions, use the addAttribute
method. Here’s an example:
//Android
GlobalRumMonitor.get().addAttribute("department", "marketing")
//iOS
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.
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 page. When you review the RUM with Session Replay Sessions and RUM Sessions columns, you can see the number of sessions by department.
Usage information is also available through the GetHourlyUsageAttribution
endpoint.
Enforced RUM Usage Attribution is in Preview. To request access, contact Datadog Support.
Enforce usage attribution tags on RUM applications to track their contribution to your Datadog bill. This setting can be applied without having to instrument or re-instrument your application. When this setting is active, tags must be set when creating or updating RUM applications in Datadog.
Note: When attribution tags are set at both the data level (in the events collected by the SDK) and application level, Datadog uses the information set at the application level.
In a Datadog environment with parent and child organizations where the setting is enforced in both, you must set attribution tags for each. For instance, if the parent requires three tags and the child two, the child org inherits the parent org’s tag, bringing the total of five tags per application on the child org (an application on the parent org would only require three tags in this example).
Note: Even when tags are not enforced on the parent org, the child org still inherits the tags from the parent org.
Ensure you have the RUM Settings Write permission.
Navigate to Digital Experience > Real User Monitoring > Manage Applications > Enforce Usage Attribution.
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.
Once this setting is enabled, previously created apps will have empty tag values, so you have to manually backfill the values manually.
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:
- Go to the RUM Application Management page.
- When creating a new application or updating one, you can see how many of the required tags have been added.
- Click Edit tags to assign the configured usage attribution tags.
- Click Save Changes.
Further reading
Additional helpful documentation, links, and articles: