- Newest
- Most votes
- Most comments
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
Relevant content
- asked 2 years ago
- asked 8 months ago
- asked 3 years ago
