Dynatrace can track business events and analyze conversion funnels, but its real magic lies in how it connects these business outcomes directly to the underlying code and infrastructure that drove them.

Let’s say a user abandons a shopping cart. You could see this in your e-commerce platform’s analytics. But Dynatrace shows you why they abandoned it: a slow API call to the payment gateway, a JavaScript error on the checkout page, or even a resource contention issue on the database server processing the order.

Here’s a simplified view of how it works. When an action happens in your application that signifies a business event (like adding an item to a cart, completing a purchase, or submitting a form), your code explicitly tells Dynatrace about it. Dynatrace then automatically captures all the context surrounding that event: which user, what device, what browser, and crucially, the entire trace of the request from the front-end through all your backend services and database calls.

This means you can define your conversion funnel steps using these custom business events. For instance, a typical e-commerce funnel might look like:

  1. ViewProductPage: User browses an item.
  2. AddToCart: User adds it to their cart.
  3. InitiateCheckout: User starts the checkout process.
  4. PaymentProcessed: Payment is successfully captured.
  5. OrderCompleted: The order is confirmed.

You define these events in your code using the Dynatrace SDK. For example, in Java, it might look something like this:

import com.dynatrace.oneagent.sdk.OneAgentSDK;
import com.dynatrace.oneagent.sdk.api.Dynatrace;
import com.dynatrace.oneagent.sdk.api.TechnicalCircumstances;
import com.dynatrace.oneagent.sdk.api.enums.LifecycleState;

// ... inside your application logic ...

OneAgentSDK dt = Dynatrace.createInstance();

// When a user adds an item to the cart
dt.addCustomRequestAttribute("AddToCart", "UserAddedItemToCart");

// When a payment is processed successfully
dt.addCustomRequestAttribute("PaymentProcessed", "PaymentSuccessful");

The addCustomRequestAttribute method is a simple way to send these events. For more complex scenarios, you can use Dynatrace.createCustomApplicationEvent() for client-side events or Dynatrace.createCustomServiceEvent() for server-side events, which allow for richer metadata.

Once these events are flowing, Dynatrace aggregates them. You can then go into the Dynatrace UI, navigate to "Business events," and start building your funnels. You select the sequence of events you defined, and Dynatrace visualizes the drop-off rates at each stage.

But here’s where it gets powerful: for each step in your funnel, and for each drop-off, Dynatrace shows you the root cause. If 15% of users drop off between AddToCart and InitiateCheckout, Dynatrace will highlight the specific transactions, services, or even code lines that were failing or performing poorly for those users. You’ll see the actual error messages, the slow database queries, or the overloaded server instances that prevented them from proceeding. This isn’t just reporting; it’s direct, actionable insight into your business performance at a technical level.

Consider a scenario where your PaymentProcessed event isn’t firing as expected for a segment of users. Dynatrace will not only show you the count of failed attempts but, by drilling down, will reveal that the underlying issue is a spike in 5xx errors from your payment gateway’s API, specifically tied to a recent deployment of your order processing service. You can then see the exact trace of those failed payment attempts, identifying the specific requests that timed out or returned errors, and pinpoint the exact line of code in your service that initiated the failing call.

The true power is in the automatic PurePath tracing that Dynatrace provides. Every business event is anchored to a full end-to-end trace. This means when you look at a conversion funnel and see a bottleneck, Dynatrace has already captured the detailed performance data for every component involved in that specific user’s journey. You don’t need to correlate separate analytics tools with APM data; it’s all unified.

When defining your custom events, it’s crucial to use consistent naming conventions and to include relevant properties. For instance, for an AddToCart event, you might want to include properties like productId, quantity, and price. This allows for much more granular analysis within your funnels, enabling you to understand which products are most frequently added but rarely purchased, or which price points cause significant drop-offs.

The mechanism that allows Dynatrace to correlate these custom events with the underlying transactions is the automatic context injection performed by the OneAgent. When your application code calls the Dynatrace SDK to record an event, the OneAgent, which is running within the same process or on the same host, captures that event and attaches it to the current distributed trace. This trace is then propagated across service boundaries, ensuring that the event is linked to the entire request lifecycle, regardless of how many microservices are involved.

A common pitfall is not instrumenting enough events, leading to funnels that don’t accurately reflect the user journey. Conversely, instrumenting too many granular events without clear business value can clutter your data. The sweet spot is to focus on key milestones that directly impact your business KPIs.

Understanding the interplay between custom events and the automatically captured PurePath is key to unlocking Dynatrace’s full potential for business analysis.

Want structured learning?

Take the full Dynatrace course →