• Home
  • Solutions
  • Business Analytics
  • Business event capture

Business event capture

powered by Grail

To get started with business events, you first need to define the scope of the data you want to capture. The approach depends on the source of the business events.

There are three sources for business events.

  • OneAgent

    Configure using the Dynatrace menu to add capture rules, triggers, data fields, and more.

  • Web and mobile RUM

    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).

Get business events via OneAgent

OneAgent version 1.253+

To capture business events using OneAgent, you need to first enable the feature.

  1. From the Dynatrace menu, go to Settings > Preferences > OneAgent features.

  2. 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 that 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.

FieldTypeDescriptionExamples
event.categorystringStandard categorization based on the significance of an event according to the ITIL event management standardAvailability
event.typestringThe unique type identifier of a given eventbuy-asset, sell-asset, login
event.providerstringSource of the event, for example, the name of the component or system that generated the eventOneAgent, easyTrade.com, easyTravel.com

Supported technologies

Supported technologies are listed in the table below.

AgentOneAgent featureMin. versionTechnologies supportedMin. versionCompressed bodyFull body

Enablement (Event capturing)

Application/json (Payload capturing)

Webserver

Webserver Business Events

253

Apache
NGINX
IIS

253

.NET

.NET Business Events

253

253

Java

Java Business Events

253

Servlet

  • Tomcat 1
  • Jetty
  • jboss
  • Websphere (+liberty)
  • weblogic
  • undertow.io
  • glassfish

253

NodeJS

Node.js Business Events

259

259

GoLang

Go Business Events

263

263

(265)

1

Tomcat 10 support—OneAgent version 1.263+ and OneAgent Settings 'servlet 5 support' required

Configure business event sources on OneAgent

OneAgent version 1.253+

To configure business event sources on OneAgent

  1. From the Dynatrace menu, go to Settings > Business Analytics > Business Event Sources > OneAgent.

  2. Select Add new capture rule and name your rule.

  3. Select Add trigger to define a condition that will be used to trigger a business event.

    Determine the data source for your trigger, such as Body, Path, or HTTP header, and 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.

    • The Summary tab displays the entire trigger rule (for example, Request - Path starts with '/api/trade/BuyAssets).
    • By default, the search for value is not case sensitive. Turn on Case sensitive if you want your trigger to consider the case of the source.
    • Triggers are connected by AND logic; if you set multiple trigger rules, all of them need to be fulfilled to capture a business event.
    • The first matching rule get executed per Agent per request.
    • We recommend that you set specific trigger rules. If a trigger rule is too general and results in multiple identical rule matches, you will get multiple business events.
  4. 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.

  5. Select Event type source and value.

    This describes the type of event the event provider is sending, such as Asset purchase.

  6. 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 payload.

  7. Select Add data field in Event data. Provide a field name, and then provide the data source and value from the JSON 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

    json
    { "accountId":6, "amount":10, "instrumentId":1, "price":157.025 }
  8. Select Save changes.

Example of data extraction

The following table shows additional examples of how to extract data from incoming JSON payloads.

Example request-payload JSON file for OneAgent
  • 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:

    json
    { "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":[ "fency", "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 } ] } }
Field nameSourcePathResultDescription

transactionId

Request-Body

transactionId

1748-2b59-5c78-9c75-f500-274a-88f5-7965

Capturing a top-level attribute

userName

Request-Body

user.userName

johndoe

Capturing a nested attribute

priceOfItems

Request-Body

items.0.price

175.99

Capturing the first array item attribute

Last tag

Request-Body

order.tags.-1

Vintage

Capturing the last element of an array

Second last tag

Request-Body

order.tags.-2

Classic

Capturing the second last element of an array

FullBody

Request-Body

*

The full body as a string

Capturing a full request body

ContentType

Request-HTTP Header

Content-Type

application/json

Capturing a certain request header

Action

Request-Query String parameters

action

addItems

Capturing a certain query string parameter

Get business events from RUM

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.

To enable RUM business events, contact a Dynatrace product expert.

To start a conversation with a Dynatrace product expert, use live chat within your Dynatrace environment.

Check the sections below for instructions on how to report business events for different platforms.

RUM JavaScript

Android

iOS

Cordova1

Xamarin

Flutter

.NET MAUI

React Native

OpenKit

1

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.

Send business events via RUM JavaScript
json
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);