Interface UserAction
A user action represents a significant operation within the mobile frontend. It groups the requests, navigations, and errors that result from a single user interaction, giving you a complete picture of what happened and how long it took. For example, a user action starts when a user presses a button and ends when the resulting network call completes and a new screen is displayed.
When creating a user action you can specify a custom name, attach event properties, and
complete it programmatically using complete().
Example (Kotlin)
val userAction = Dynatrace.createUserAction(
UserActionConfiguration("Place Order")
)
userAction.addEventProperty("event_properties.cart_size", 3.0)
userAction.addEventProperty("event_properties.currency", "USD")
// ... perform the workflow ...
userAction.addEventProperty("event_properties.succeeded", true)
userAction.complete()
After a user action is completed, subsequent method calls have no effect and do not throw exceptions.
- Since:
- 8.343
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddEventProperty(String key, boolean value) Adds or updates abooleanevent property scoped to this user action.voidaddEventProperty(String key, double value) Adds or updates adoubleevent property scoped to this user action.voidaddEventProperty(String key, int value) Adds or updates anintevent property scoped to this user action.voidaddEventProperty(String key, long value) Adds or updates alongevent property scoped to this user action.voidaddEventProperty(String key, String value) Adds or updates aStringevent property scoped to this user action.voidcomplete()Closes this user action immediately, regardless of any pending web requests.Returns the user action name supplied viaUserActionConfiguration.booleanReturns the current value of thecompleteAutomaticallyflag.voidsetCompleteAutomatically(boolean enabled) Sets whether this user action closes automatically or must be closed manually withcomplete().
-
Method Details
-
getCustomName
String getCustomName()Returns the user action name supplied viaUserActionConfiguration.- Returns:
- the custom name supplied via
UserActionConfiguration
-
isCompleteAutomatically
boolean isCompleteAutomatically()Returns the current value of thecompleteAutomaticallyflag.- Returns:
trueif the user action will be closed automatically;falseif an explicit call tocomplete()is required
-
setCompleteAutomatically
void setCompleteAutomatically(boolean enabled) Sets whether this user action closes automatically or must be closed manually withcomplete().When
true, the user action will be closed automatically once the pending web request or navigation events for this action complete. Whenfalse, the user action remains open untilcomplete()is called or the action reaches its maximum duration.- Parameters:
enabled-trueto enable automatic completion;falseto require an explicitcomplete()call
-
complete
void complete()Closes this user action immediately, regardless of any pending web requests.Calling this method on an already-closed user action has no effect.
-
addEventProperty
Adds or updates aStringevent property scoped to this user action.Property keys must be prefixed with
"event_properties.". Any property without this prefix will be dropped during validation.- Parameters:
key- the property key; ifnullor invalid the key–value pair will be droppedvalue- the property value
-
addEventProperty
Adds or updates anintevent property scoped to this user action.Property keys must be prefixed with
"event_properties.". Any property without this prefix will be dropped during validation.- Parameters:
key- the property key; ifnullor invalid the key–value pair will be droppedvalue- the property value
-
addEventProperty
Adds or updates alongevent property scoped to this user action.Property keys must be prefixed with
"event_properties.". Any property without this prefix will be dropped during validation.- Parameters:
key- the property key; ifnullor invalid the key–value pair will be droppedvalue- the property value
-
addEventProperty
Adds or updates adoubleevent property scoped to this user action.Property keys must be prefixed with
"event_properties.". Any property without this prefix will be dropped during validation. Non-finite values such asDouble.NaN,Double.POSITIVE_INFINITY, andDouble.NEGATIVE_INFINITYare not supported and will be nullified.- Parameters:
key- the property key; ifnullor invalid the key–value pair will be droppedvalue- the property value
-
addEventProperty
Adds or updates abooleanevent property scoped to this user action.Property keys must be prefixed with
"event_properties.". Any property without this prefix will be dropped during validation.- Parameters:
key- the property key; ifnullor invalid the key–value pair will be droppedvalue- the property value
-