- Newest
- Most votes
- Most comments
While AWS CloudWatch RUM is designed to monitor a single application, there are ways to capture user analytics for multiple domains using this service. Here's how you can approach this situation:
-
Create separate app monitors: You'll need to create a separate app monitor for each domain you want to monitor. This means you'll have three different app monitors, one for each of your domains (domain1.com, domain2.com, domain3.com).
-
Use different JavaScript snippets: Each app monitor will generate a unique JavaScript snippet. You'll need to implement logic in your application to load the appropriate snippet based on the current domain.
-
Implement conditional loading: In your application code, you can use JavaScript to detect the current domain and load the corresponding RUM snippet. For example:
if (window.location.hostname === 'domain1.com') { // Load RUM snippet for domain1.com } else if (window.location.hostname === 'domain2.com') { // Load RUM snippet for domain2.com } else if (window.location.hostname === 'domain3.com') { // Load RUM snippet for domain3.com } -
Permissions and settings: For each app monitor, you'll need to ensure that the correct permissions are set up. If you're using the simplest option with Amazon Cognito identity pools, CloudWatch RUM will create the necessary resources automatically. This includes:
- A new Amazon Cognito identity pool
- An unauthenticated Amazon Cognito identity
- An IAM role that allows the RUM web client to use the
PutRumEventsAPI with the app monitor resource
-
Data analysis: Keep in mind that since you're using separate app monitors, the data for each domain will be collected separately. You may need to aggregate this data manually or use additional tools to get a comprehensive view across all domains.
-
Consider using custom events: If you need to track specific events or metrics that are common across all domains, you can use custom events in CloudWatch RUM. This can help you maintain consistency in your analytics across the different domains.
By following this approach, you can effectively capture user analytics for multiple domains using AWS RUM. However, be aware that this setup may require more management overhead and could potentially impact your billing as you're essentially running multiple instances of RUM.
Remember to review the CloudWatch RUM documentation for any updates or changes to the service that might affect this setup, and consider reaching out to AWS support if you need further assistance with your specific use case.
Sources
CloudWatch RUM - Amazon CloudWatch
Authorizing your application to send data to AWS through CloudWatch RUM - Amazon CloudWatch
Hi,
Given the fact that AWS RUM supports subdomains (see below), you could try to trick it by creating a DNS aliases for all your domains under a common head domain and then check the "include sub domains" box to have all of them under 1 one (No guarantee: it's a guess...)
Best,
Didier
Relevant content
- asked 3 months ago
