To get started with business events, you first need to define the scope of the data you want to capture. The approach you use depends on the source of the business events.
There are three sources for business events.
Configure in Dynatrace to add capture rules, triggers, data fields, and more.
Obtain RUM business events by leveraging a dedicated method of the RUM JavaScript API, OneAgent for mobile, or OpenKit.
External sources
Configure external business or IT systems to send business events in JSON format to the business events API (REST endpoint).
OneAgent version 1.253+
To capture business events using OneAgent, you need to first enable the feature.
Go to Settings > Preferences > OneAgent features.
Enable the OneAgent business events feature for the technologies appropriate for your environment.
You need to restart the application process before you can capture business events from the process.
Configuration requires one or more capture rules that consist of triggers, mandatory data fields, and optional event data fields.
The table below contains examples of mandatory (event.type
, event.provider
) and optional (event.category
) data fields.
event.category
Availability
event.type
buy-asset
, sell-asset
, login
event.provider
OneAgent
, easyTrade.com
, easyTravel.com
Agent | OneAgent feature | Min. version | Technologies supported | Min. version | Compressed body | Full body | Min. version | Compressed body | Full body |
---|---|---|---|---|---|---|---|---|---|
Enablement (event capture) | application/json (payload capture) | Header: XML (payload capture)1 | |||||||
Webserver | Webserver Business Events | 1.253 |
| 1.253 | 1.275 | ||||
.NET | .NET Business Events | 1.253 | 1.253 | 1.279 | |||||
Java | Java Business Events | 1.253 | Servlet
| 1.253 | 1.275 | ||||
Node.js | Node.js Business Events | 1.259 | 1.259 | n/a | |||||
Golang | Go Business Events | 1.263 | 1.263 | (1.265) | n/a |
Supported content types for XML capture by default are text/xml
and application/xml
.
Tomcat 10 support—OneAgent version 1.263+ and Java Servlet 5.0 Oneagent feature (in Settings > Preferences > OneAgent features) required
Agent | OneAgent feature | Min. version | Technologies supported | Min. version | Compressed body | Full body | Min. version | Compressed body | Full body |
---|---|---|---|---|---|---|---|---|---|
Enablement (event capture) | application/json (payload capture) | Header: XML (payload capture)1 | |||||||
Java | Java Business Events | 1.297 | HTTP Clients
| 1.297 | 1.297 | ||||
1.297 | HTTP Clients
| 1.297 | 1.297 |
OneAgent version 1.253+
To configure business event sources on OneAgent
Go to Settings > Business Analytics > OneAgent Business Event Sources.
Select Add new capture rule and name your rule.
Select Add trigger to define a condition that will trigger a business event.
Determine the data source for your trigger, such as the request Body, Path, or HTTP Header. Then select an Operator and define a Value. This allows you to match content retrieved from the source to the value you define. When OneAgent matches the trigger, a business event is generated.
Request - Path starts with '/api/trade/BuyAssets
).AND
logic within a rule; if you set multiple triggers, all of them need to be fulfilled to capture a business event.contains api
, and the term api
is used in many of your applications, data can end up being captured from where it shouldn't be.Do not create triggers where the value is simply /
; this can lead to overloading and shutting down your application environment.
Select the Event provider source and value.
This describes the source of the event, such as www.easytrade.com
. The data source for this field can be a fixed value that you provide or it can be extracted from the event.
Select the Event type source and value.
This describes the type of event sent by the event provider, such as Asset purchase
.
optional Select Event category source and value to add helpful context to the event (for example, add a stock exchange name such as NASDAQ
).
This step concludes the configuration of a business event that will be generated each time the trigger criteria are matched. This might be sufficient if all you need is to count the number of matching events (for example, to answer the question of how many asset purchases were made). In most cases, however, you will want to add event attributes for more granular insight (described in the step below). Attributes are data fields extracted from the event JSON or XML payload.
Select Add data field in Event data. Provide a field name, and then provide the data source and value from the JSON or XML payload. This describes the attribute-value pair that will be associated with the event, such as accountId
, amount
, instrumentId
, or price
. Adding such pairs can help you answer more complex questions such as how many accounts purchased a particular asset, which assets are purchased most often, or which accounts make the largest asset purchases.
Example buy-asset request JSON file
{"accountId":6,"amount":10,"instrumentId":1,"price":157.025}
Select Save changes.
Ensure that the rule is set to Enabled.
OneAgent capture rules can also be defined at the host or host-group level to limit the scope of capture.
The following table shows additional examples of how to extract data from incoming JSON payloads.
Request URL—example.dynatrace.com/api?action=addItems
Request headers
Accept
—*/*
Accept-Encoding
—gzip, deflate
Accept-Language
—en-US,en;q=0.9
Connection
—keep-alive
Content-Length
—64
Content-Type
—application/json
Request payload
{"time":"2022-03-12T12:16:36.5881611+00:00","transactionId":"1748-2b59-5c78-9c75-f500-274a-88f5-7965","user":{"user.id":"1684588","userName":"johndoe","name":"John","surname":"Doe","email":"me@johndoe.one"},"order":{"order.id":"58449798","retailer":{"id":"558","name":"HappyShop"},"amount":240.44,"currency":"usd","tags":["fancy","modern","classic","vintage"],"items":[{"itemId":"674","price":175.99,"productName":"Product A","productCategory":"Furniture","quantity":1},{"itemId":48,"price":12.89,"productName":"Product Z","productCategory":"Decoration","quantity":5}]}}
The extraction of data from XML payloads works with the same syntax as for JSON.
<LogoutRequest id=”102030AF”><accountId>100</accountId></LogoutRequest>
<?xml version="1.0" encoding="UTF-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><Tagh1 xmlns="http://tempuri.org/"><Tagh2 cusType="A" xmlns:a="http://schemas.datacontract.org/ex" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><a:Code i:nil="true" /><a:Name>MyCustomer1</a:Name><a:TotalValue>45</a:TotalValue></Tagh2></Tagh1></s:Body></s:Envelope>
Data capture from requests and responses is available for both JSON and XML.
The following table shows examples of how to extract data from requests and is based on the JSON payload example above.
RequestHeaders
*
QueryParameters
*
Business events are available for all Dynatrace RUM technologies (web RUM, mobile RUM, and OpenKit). RUM business events can be obtained by leveraging a dedicated method of the RUM JavaScript, OneAgent for mobile, or OpenKit.
Check the sections below for instructions on how to report business events for different platforms.
To report business events for the native part of Cordova applications, follow the instructions for Android or iOS. For the web part, use the RUM JavaScript.
let attributes = {"event.name": "Confirmed Booking","page": "booking-confirmation","product": "Danube Anna Hotel","amount": 358.35,"currency": "USD","reviewScore": 4.8,"arrivalDate": "2022-11-05","departureDate": "2022-11-15","journeyDuration": 10,"adultTravelers": 2,"childrenTravelers": 0};dynatrace.sendBizEvent('com.easytravel.funnel.booking-finished', attributes);
Business events are only captured for monitored sessions. When the RUM JavaScript is disabled either through a special method or due to cost and traffic control, business events are not reported for such sessions. Note that this behavior might be subject to change in the future, potentially allowing business events to be sent to Dynatrace regardless of session monitoring.