Skip to content

Capturing application's screen resolution through CloudWatch RUM.

0

Hi, I can see by default CloudWatch doesn't capture application's screen size while RUM is enabled.

Can you tell me wether it is possible to capture this? If yes How?

1 Answer
2

Yes, you can capture your application's screen resolution through CloudWatch RUM by using custom session attributes. While screen resolution isn't captured by default in the standard metrics, you can add this information as custom metadata.

You can implement this by adding screen resolution as a session attribute either during CloudWatch RUM web client initialization or at runtime using the addSessionAttributes command. Here's how you could do it during initialization:

const config = {
allowCookies: true,
endpoint: "https://dataplane.rum.us-west-2.amazonaws.com",
guestRoleArn: "arn:aws:iam::000000000000:role/RUM-Monitor-us-west-2-000000000000-00xx-Unauth",
identityPoolId: "us-west-2:00000000-0000-0000-0000-000000000000",
sessionSampleRate: 1,
telemetries: ['errors', 'performance'],
sessionAttributes: {
screenWidth: window.screen.width,
screenHeight: window.screen.height
}
};

Once configured, these screen resolution values will be added to all events in the session. You can then use these attributes to filter your visualizations in the CloudWatch RUM console, allowing you to analyze user experience based on different screen resolutions.

Each event can include up to 10 custom attributes in the metadata, and the keys must be between 1-128 characters. The values can be strings, numbers, or Boolean values with a maximum length of 256 characters.
Sources
Specify custom metadata - Amazon CloudWatch

answered 9 months ago
EXPERT
reviewed 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.