Correlating Front‑End User Actions with Backend Traces in Dynatrace for React Apps
Learn how to correlate front‑end user actions in a React app with backend PurePath traces using Dynatrace RUM to pinpoint performance bottlenecks.
11 Jul 2026, 08:41 UTC

Problem: Slow React page loads leave teams guessing
Many teams observe intermittent latency in a single‑page React application. Without a clear signal, they spend time checking network waterfalls, profiling JavaScript bundles, or reviewing database logs, hoping to find the culprit. The guesswork wastes effort and delays fixes.
Thesis: Dynatrace Real User Monitoring (RUM) combined with existing PurePath traces gives a unified view that pinpoints the exact tier responsible for each user‑experience delay.
1. Inject the Dynatrace JavaScript agent
Add the RUM snippet provided by your Dynatrace environment to the <head> of your HTML template. The snippet loads the dt global object and begins automatic page‑load monitoring.
<!-- Dynatrace RUM snippet -->
<script>
(function(){var d=document;var s=d.createElement('script');s.async=true;s.src='https://www.dynatrace.com/rum/javascript-agent/your-environment-id.js';d.getElementsByTagName('head')[0].appendChild(s);})();
</script>
No special permissions are required beyond the ability to edit the application’s static assets. After deployment, verify that the agent loads by opening the browser console and checking for the dt object.
2. Add custom actions for critical user flows
Automatic monitoring captures page loads, but to trace a specific interaction (e.g., clicking the “Checkout” button) you must call the RUM API.
// Example: after a button click in a React component
import { useEffect } from 'react';
function CheckoutButton() {
const handleClick = () => {
// Your business logic
// ...
// Notify Dynatrace of the action
if (window.dt) {
window.dt('action', 'click', 'CheckoutButton');
}
};
return <button onClick={handleClick}>Checkout</button>;
}
export default CheckoutButton;
Choose a short, stable name (e.g., CheckoutButton) and keep it consistent across releases; changing the name breaks historical trend analysis.
3. Correlate with backend PurePath traces
Ensure the backend service handling the request is instrumented with Dynatrace OneAgent so that the request ID propagates from the browser to the server. When the user action is recorded, Dynatrace automatically links it to the corresponding PurePath.
In the Dynatrace UI:
- Navigate to User Sessions.
- Filter by the custom action name you defined (e.g.,
action.name = "CheckoutButton"). - Open a session and click the PurePath tab to see the server‑side call stack, database query times, and any external service calls.
Compare the timestamp of the front‑end action with the duration of the backend PurePath. If the backend dominates, focus optimization there; if the front‑end time is large, look at JavaScript execution or rendering.
Worked example: end‑to‑end verification
- Deploy OneAgent on your application servers and confirm that PurePath traces appear under Transactions → PurePaths.
- Add the RUM snippet to a test page and redeploy.
- Open the page, open the browser console, and verify
window.dtis defined. - Trigger the custom action (e.g., click the Checkout button).
- In Dynatrace, go to User Sessions, filter for
CheckoutButton, and confirm a session appears with a linked PurePath. - Check that the action timestamp and the PurePath start time differ by roughly the expected network latency (typically a few milliseconds).
If the linked PurePath does not appear, verify that the request ID header is being passed (OneAgent adds dtmetadata or similar) and that there are no ad‑blockers or CSP rules blocking the RUM agent.
Trade‑off and limitation
The RUM agent adds a small overhead—usually under 5 ms per page view—which is negligible for most applications. The main cost is the need to modify front‑end code to define custom actions and to maintain those names over time. Teams should start with automatic page‑load monitoring, then incrementally add custom actions for high‑value flows, and regularly review the User Experience dashboard to confirm that performance improvements are reflected in real‑user data.
Actionable closing
By linking Dynatrace RUM actions to backend PurePaths, you move from guessing to measuring: you can see exactly whether a slow checkout is caused by a sluggish API call, a long‑running database query, or heavy client‑side rendering. Implement the snippet, instrument your critical clicks, and use the linked traces to drive targeted optimizations.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.