Instrumenting Windows IIS Server
To try the preview for RUM Auto-Instrumentation, follow the instructions on this page.
Overview
RUM Auto-Instrumentation works by injecting the RUM Browser SDK into the HTML responses being served through a web server or proxy. This method leverages a Windows module that injects the RUM SDK into the response body for responses served by the IIS instance. After auto-instrumentation is set up, you can manage configurations from the UI.
To understand important limitations and compatibility requirements, see Limitations.
Prerequisites
The Datadog Agent is installed and configured.
Set up your RUM application
- In Datadog, navigate to the Digital Experience > Manage Applications Page, click on New Application, and select the JavaScript (JS) application type.
- Select Auto-Instrumentation and Windows IIS.
- Configure your application parameters. See guidance on configuring sampling.
- Set up the IIS module using either the GUI installer or command line as described below:
- Download the Datadog RUM installer.
- Follow the installer as an administrator by opening the
.msi file. - Follow the prompts and accept the license agreement.
- Set your Session and Session Replay sample rates. See guidance on configuring sampling.
- Copy and run the config command shown for each IIS site that you wish to inject RUM into.
- Run the Powershell command line as an administrator.
- Set your Session and Session Replay sample rates. See guidance on configuring sampling.
- Copy and run the config command shown for each IIS site that you wish to inject RUM into.
Updating your RUM application
You can update your RUM application settings at any time. From the Application Management list, select your RUM application and navigate to the SDK Configuration page. Click Save Changes after making updates.
Sampling rates
Adjust the slider or enter a specific percentage in the input box for Session Sampling or Session Replay Sampling. Copy and replace the code in the Datadog RUM config file for the IIS site that you instrumented.
Advanced configuration
After you have RUM Auto-Instrumentation set up, configure User Attributes and Allowed Tracing URLs directly from the Datadog UI without modifying your application code.
User attributes
User Attributes allow you to associate RUM sessions with specific users, enabling you to:
- Track individual user journeys across your application
- Filter and search sessions by user details
- Gain insights into user-specific issues and behaviors
Configure three user properties: User ID, User Name, and User Email.
Source types
For each user attribute, select how the RUM SDK should extract the value:
| Source | Description | Example |
|---|
| JavaScript | Read from a JavaScript variable on the page | window.currentUser.id or dataLayer.user.email |
| Cookie | Read from a browser cookie | Cookie name: user_session |
| DOM | Read from an HTML element’s text content or attribute | CSS selector: #user-id or [data-user-email] |
Use a regex pattern to extract specific values when your source contains extra characters. For example:
- Source value:
user_id=12345;session=abc - Regex pattern:
user_id=(\d+) - Extracted value:
12345
If your regex pattern includes a capture group (parentheses), the SDK extracts that value. Otherwise, it extracts the entire matched string.
Allowed tracing URLs
Configure allowed tracing URLs to connect your RUM sessions to backend APM traces. This provides end-to-end visibility from the browser to your backend services.
When a user’s browser makes a request to an allowed URL, the RUM SDK injects trace headers. Your backend APM agent reads these headers and links the backend trace to the RUM session.
Configuration
Add the URLs of your backend services that you want to connect to RUM:
| Field | Description |
|---|
| URL | The backend URL to trace. Use an exact URL (for example, https://api.example.com) or enable Regex for pattern matching (for example, https://.*\.example\.com). |
| Propagator Type | The trace header format your backend expects. Options: datadog, tracecontext (W3C), b3, b3multi. Select multiple if needed. |
Tracing requires a configured service name. Set this in the App Attributes section.
Learn more
See Connect RUM and Traces for detailed information about RUM and APM integration.
Manual configuration
Log Level
You can configure the log level in the IIS applicationHost.config file:
<configuration>
<system.applicationHost>
<datadogRumServer logLevel="debug" />
</system.applicationHost>
</configuration>
The possible logLevel values are:
Allowed tracing URLs
To connect RUM sessions and APM traces you can configure allowedTracingUrls in the site’s web.config file with comma-separated fixed URLs in the datadogRum section. Regular expressions and Javascript functions are unsupported. See more information about trace correlation.
<datadogRum>
...
<option name="allowedTracingUrls" value="https://api.example.com,https://other.example.com" />
</datadogRum>
Troubleshooting
RUM is not injected
If you notice that RUM is not being injected into HTML pages, consider the following potential causes:
- Content-Type mismatch: RUM is injected only into HTML pages. If the
Content-Type header does not correctly indicate text/html, the injection is skipped.
Limitations
See other Limitations.
Uninstall
To completely remove RUM Auto-Instrumentation, uninstall Datadog RUM using the Windows Apps & Features tool.
Further reading
Additional helpful documentation, links, and articles: