Configuring the CloudWatch RUM web client
Your applications can use one of the code snippets generated by CloudWatch RUM to install the CloudWatch RUM web client.
The generated snippets support two installation methods: as a JavaScript module through NPM, or from a
content delivery network (CDN). For best performance, we recommend using the NPM installation method.
For more information about using
this method, see
Installing as a JavaScript Module
If you use the CDN installation option, ad blockers might block the default CDN provided by CloudWatch RUM. This disables application monitoring for users
who have ad blockers installed. Because of this, we recommend that you use the default CDN only for initial onboarding
with CloudWatch RUM. For more information about the ways to mitigate this issue, see
Instrument the application
The code snippet sits in the <head>
tag of an HTML file and installs the web client by
downloading the web client, and then configuring the web client for the application it is monitoring.
The snippet is a self-executing
function which looks similar to the following. In this example, the body of the snippet's
function has been omitted for
readability.
<script> (function(n,i,v,r,s,c,u,x,z){...})( 'cwr', '00000000-0000-0000-0000-000000000000', '1.0.0', 'us-west-2', 'https://client.rum.us-east-1.amazonaws.com/1.0.2/cwr.js', { /* Configuration Options Here */ } ); <script>
Arguments
The code snippet accepts six arguments:
A namespace for running commands on the web client, such as
'cwr'
The ID of the app monitor, such as
'00000000-0000-0000-0000-000000000000'
The application version, such as
'1.0.0'
The AWS Region of the app monitor, such as
'us-west-2'
The URL of the web client, such as
'https://client.rum.us-east-1.amazonaws.com/1.0.2/cwr.js'
Application-specific configuration options. For more information, see the following section.
Ignoring errors
The CloudWatch RUM web client listens to all types of errors that happen in your applications. If your application emits JavaScript errors that you do not want to view in the CloudWatch RUM dashboard, you can configure the CloudWatch RUM web client to filter out these errors so that you see only the relevant error events on the CloudWatch RUM dashboard. For example, you might choose not to view some JavaScript errors in the dashboard because you have already identified a fix for them and the volume of these errors is masking other errors. You might also want to ignore errors that you can't fix because they are owned by a library owned by a third party.
For more information about how to instrument the
web client to filter
out specific JavaScript errors, see the example in
Errors
Configuration options
For information about the configuration options available for the CloudWatch RUM web client,
see the
CloudWatch RUM web client documentation