# Real User Monitoring With CloudWatch RUM, you can perform real user monitoring to collect and view client-side data about your web application performance from actual user sessions in near real time. The data that you can visualize and analyze includes page load times, client-side errors, and user behavior. When you view this data, you can see it all aggregated together, and also see breakdowns by the browsers and devices that your customers use. ![RUM application monitor dashboard showing device breakdown](../images/rum2.png) ## Web client The CloudWatch RUM web client is developed and built using Node.js version 16 or higher. The code is [publicly available](https://github.com/aws-observability/aws-rum-web) on GitHub. You can use the client with [Angular](https://github.com/aws-observability/aws-rum-web/blob/main/docs/cdn_angular.md) and [React](https://github.com/aws-observability/aws-rum-web/blob/main/docs/cdn_react.md) applications. CloudWatch RUM is designed to create no perceptible impact to your application’s load time, performance, and unload time. !!! note End user data that you collect for CloudWatch RUM is retained for 30 days and then automatically deleted. If you want to keep the RUM events for a longer time, you can choose to have the app monitor send copies of the events to CloudWatch Logs in your account. !!! tip If avoiding potential interruption by ad blockers is a concern for your web application then you may wish to host the web client on your own content delivery network, or even inside your own web site. Our [documentation on GitHub](https://github.com/aws-observability/aws-rum-web/blob/main/docs/cdn_installation.md) provides guidance on hosting the web client from your own origin domain. ## Authorize Your Application To use CloudWatch RUM, your application must have authorization through one of three options. 1. Use authentication from an existing identity provider that you have already set up. 1. Use an existing Amazon Cognito identity pool 1. Let CloudWatch RUM create a new Amazon Cognito identity pool for the application !!! success Letting CloudWatch RUM create a new Amazon Cognito identity pool for the application requires the least effort to set up. It's the default option. !!! tip CloudWatch RUM can configured to separate unauthenticated users from authenticated users. See [this blog post](https://aws.amazon.com/blogs/mt/how-to-isolate-signed-in-users-from-guest-users-within-amazon-cloudwatch-rum/) for details. ## Data Protection & Privacy The CloudWatch RUM client can use cookies to help collect end user data. This is useful for the user journey feature, but is not required. See [our detailed documentation for privacy related information](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-RUM-privacy.html).[^1] !!! tip While the collection of web application telemetry using RUM is safe and does not expose personally identifiable information (PII) to you through the console or CloudWatch Logs, be mindful that you can collect [custom attribute](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-RUM-custom-metadata.html) through the web client. Be careful not to expose sensitive data using this mechanism. ## Client Code Snippet While the code snippet for the CloudWatch RUM web client will be automatically generated, you can also manually modify the code snippet to configure the client to your requirements. !!! success Use a cookie consent mechanism to dynamically enable cookie creation in singe page applications. See [this blog post](https://aws.amazon.com/blogs/mt/how-and-when-to-enable-session-cookies-with-amazon-cloudwatch-rum/) for more information. ### Disable URL Collection Prevent the collection of resource URLs that might contain personal information. !!! success If your application uses URLs that contain personally identifiable information (PII), we strongly recommend that you disable the collection of resource URLs by setting `recordResourceUrl: false` in the code snippet configuration, before inserting it into your application. ### Enable Active Tracing Enable end-to-end tracing by setting `addXRayTraceIdHeader: true` in the web client. This causes the CloudWatch RUM web client to add an X-Ray trace header to HTTP requests. If you enable this optional setting, XMLHttpRequest and fetch requests made during user sessions sampled by the app monitor are traced. You can then see traces and segments from these user sessions in the RUM dashboard, the CloudWatch ServiceLens console, and the X-Ray console. Click the checkbox to enable active tracing when setting up your application monitor in the AWS Console to have the setting automatically enabled in your code snippet. ![Active tracing setup for RUM application monitor](../images/rum1.png) ### Inserting the Snippet Insert the code snippet that you copied or downloaded in the previous section inside the `` element of your application. Insert it before the `` element or any other `