ExperimentalExperimentalCreates a new controllable user action.
Optionaloptions: UserActionStartOptionsAn optional options object to configure the user action.
Options to create a user action with.
Optional ExperimentalautoClose?: booleanAutomatically closes the user action upon timeout, page hide or when new user action is detected.
default: true
Optional Experimentalname?: stringA human-readable name to identify the user action.
Optional ExperimentalstartTime?: numberThe unix timestamp indicating when the user action should start. Future timestamps are not supported - use current or past timestamps.
An UserActionTracker object that can be started and finished, or undefined if the user action module is not enabled.
const userAction = dynatrace.userActions.create({ autoClose: false });
const unsubscribe = userAction.subscribe(currentUserAction => {
console.log(`User action would have been completed due to ${currentUserAction.completeReason}`, event);
});
// execute user actions
userAction.finish();
unsubscribe();
ExperimentalDisables automatic user action detection. Useful in case it interferes with manual user action handling.
If false, disables automatic user action detection, otherwise enables it.
dynatrace.userActions?.setAutomaticDetection(false);
async function handleClick(router) {
const userAction = dynatrace.userActions?.create({ autoClose: false });
// this would normally create an user action that would finish this manual user action
await router.redirect("home");
userAction.finish();
}
ExperimentalSubscribes to user actions.
A callback function that is called whenever Dynatrace creates a new user action.
An unsubscriber function to remove the subscription.
const unsubscribe = dynatrace.userActions?.subscribe(userAction => {
// Disable automatic userAction completion
userAction.autoClose = false;
// Execute some requests or mutations, then finish the user action
userAction.finish();
});
// Some time later if you don't want to listen to userActions anymore
unsubscribe();