---
title: Instrumenting Windows IIS Server
description: >-
  Configure Windows IIS server to automatically inject RUM Browser SDK into HTML
  responses using the Datadog module installer.
breadcrumbs: >-
  Docs > RUM & Session Replay > Application Monitoring > RUM Browser Monitoring
  > Browser Monitoring Setup > Auto-Instrumentation > Instrumenting Windows IIS
  Server
---

# Instrumenting Windows IIS Server

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com



{% alert level="danger" %}
RUM Auto-Instrumentation is not available for the selected site (). Use [Client-Side instrumentation](https://docs.datadoghq.com/real_user_monitoring/application_monitoring/browser/setup/client) instead.
{% /alert %}


{% /callout %}

{% callout %}
##### Preview

RUM Auto-Instrumentation for Windows IIS is in Preview.
{% /callout %}

## Overview{% #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.

## Limitations{% #limitations %}

Auto-instrumentation for this server has the following limitations. If your use case requires more control, use [client-side instrumentation](https://docs.datadoghq.com/real_user_monitoring/application_monitoring/browser/setup/client) instead.

- This instrumentation method **does not support [advanced RUM configurations](https://docs.datadoghq.com/real_user_monitoring/application_monitoring/browser/advanced_configuration/)**.
- If your web server is acting as a proxy and the upstream server uses **end-to-end encryption** (TLS) or **content compression** (gzip, zstd, Brotli), the RUM Browser SDK **cannot be injected**. For proper instrumentation:
  - **Disable content compression** on the upstream server.
  - **Enable TLS origination** on the web server.

## Prerequisites{% #prerequisites %}

The [Datadog Agent](https://docs.datadoghq.com/agent/) is installed and configured.

## Set up your RUM application{% #set-up-your-rum-application %}

1. In Datadog, navigate to the **Digital Experience > Manage Applications Page**, click on [**New Application**](https://docs.datadoghq.com/real_user_monitoring/guide/best-practices-for-rum-sampling/), and select the JavaScript (JS) application type.
1. Select **Auto-Instrumentation** and **Windows IIS**.
1. Configure your application parameters. See [guidance on configuring sampling](https://docs.datadoghq.com/real_user_monitoring/guide/best-practices-for-rum-sampling/).
1. Set up the IIS module using either the GUI installer or command line as described below:

{% collapsible-section %}
##### Using the GUI installer (recommended)

1. Download the [Datadog RUM installer](https://rum-auto-instrumentation.s3.us-east-1.amazonaws.com/iis/latest/x64/injector_IIS.msi).
1. Follow the installer as an administrator by opening the `.msi` file.
1. Follow the prompts and accept the license agreement.
1. Set your Session and Session Replay sample rates. See [guidance on configuring sampling](https://docs.datadoghq.com/real_user_monitoring/guide/best-practices-for-rum-sampling/).
1. Copy and run the config command shown for each IIS site that you wish to inject RUM into.

{% /collapsible-section %}

{% collapsible-section %}
##### Using the command line

1. Run the Powershell command line as an administrator.
1. Set your Session and Session Replay sample rates. See [guidance on configuring sampling](https://docs.datadoghq.com/real_user_monitoring/guide/best-practices-for-rum-sampling/).
1. Copy and run the config command shown for each IIS site that you wish to inject RUM into.

{% /collapsible-section %}

## Updating your RUM application{% #updating-your-rum-application %}

You can update your RUM application settings at any time. From the [Application Management](https://app.datadoghq.com/rum/list/create/) list, select your RUM application and navigate to the **SDK Configuration** page. Click **Save Changes** after making updates.

### Sampling rates{% #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{% #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 %}

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{% #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]`   |

#### Regex extractor (optional){% #regex-extractor-optional %}

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{% #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{% #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.                                     |

{% alert level="info" %}
Tracing requires a configured **service name**. Set this in the App Attributes section.
{% /alert %}

#### Learn more{% #learn-more %}

See [Connect RUM and Traces](https://docs.datadoghq.com/real_user_monitoring/platform/connect_rum_and_traces/) for detailed information about RUM and APM integration.

## Manual configuration{% #manual-configuration %}

### Log Level{% #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:

- `debug`
- `info` (default)
- `error`

### Allowed tracing URLs{% #allowed-tracing-urls-1 %}

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](https://docs.datadoghq.com/real_user_monitoring/platform/connect_rum_and_traces/).

```
<datadogRum>
  ...
  <option name="allowedTracingUrls" value="https://api.example.com,https://other.example.com" />
</datadogRum>
```

## Troubleshooting{% #troubleshooting %}

### RUM is not injected{% #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.

## Uninstall{% #uninstall %}

To completely remove RUM Auto-Instrumentation, uninstall Datadog RUM using the **Windows Apps & Features** tool.

## Further reading{% #further-reading %}

- [Browser Monitoring Auto-Instrumentation](https://docs.datadoghq.com/real_user_monitoring/application_monitoring/browser/setup/server/)
