24 May 2023 02:18 PM - last edited on 29 May 2023 02:06 PM by AgataWlodarczyk
Our React.js SPA executes different API calls as routes change and different components load. We rarely see these XHR calls in Dynatrace RUM, however, sometimes we do, and sometimes we don't.
Do people typically need to use the Dynatrace RUM Javascript API to handle this? Seems like a lot of extra work. Any best practices for this so it doesn't become a developer burden?
31 May 2023 04:11 PM
Any information regarding this would be helpful. Seems like it catches api calls directly called off the click of a button. However, something like logging in - it catches the initial authentication api, the user is then transitioned to a post-login page which then loads additional data pertaining to that user. Many times, most of these api calls are missing.
31 May 2023 06:55 PM - edited 31 May 2023 07:00 PM
The answer is - it depends. Any chance your user action gets closed before the XHR call happens? Sometimes there are options which help such as enabling setTimeout. Not knowing details on your application, but I'd guess the XHR is not captured since it's somehow called in a way that Dynatrace is not able to link it with user action. You can try using this solution, at least temporarily. However, I'd not recommend doing it and you should try solving it in a different way.
Be sure to check the troubleshooting hints here. Still, there are situations where calling the dtrum API is inevitable.
31 May 2023 07:44 PM
We will poke around on that. Is there any reason you would not recommend that solution? It seems to just display more user actions.
31 May 2023 09:20 PM
Actually, any XHR request would trigger a user action, even without interaction. User action is designed to capture interaction performed by a user or a significant action which has a business value.