ExperimentalExperimentalAn options object to configure the user action.
Options to create a user action with.
Optional ExperimentalcompleteAutomatically?: booleanAutomatically completes the user action upon timeout, page hide or when new user action is detected.
default: false
ExperimentalcustomName: stringA human-readable custom name to identify the user action.
Optional ExperimentalcustomTrackers?: UserActionActivityTrackerRegistration[]Custom activity tracker registrations applied at action start. Each entry
pairs a tracker name (surfaced in diagnostics) with a create function
the agent invokes with an activity context. notifyActivity() extends the
quiet window without blocking completion; block() keeps the tracker
blocked until release() is called. block() and release() are
idempotent per tracker.
Equivalent to calling
UserActionTracker.registerCustomTracker with each (name, create)
pair immediately after creation.
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 completed, or undefined if the user action module is not enabled.
const userAction = dynatrace.userActions.create({ customName: "My Action", completeAutomatically: false });
const unsubscribe = userAction.subscribe(currentUserAction => {
console.log(`User action would have been completed due to ${currentUserAction.completeReason}`, event);
});
// execute user actions
userAction.complete();
unsubscribe();
ExperimentalControls automatic user action detection. Useful in case it interferes with manual user action handling.
Disabling automatic detection only prevents future automatic user actions from being created. It does not complete, interrupt, or otherwise affect the currently active user action.
If false, pauses creation of future automatic user actions; otherwise resumes it.
dynatrace.userActions?.setAutomaticDetection(false);
async function handleClick(router) {
const userAction = dynatrace.userActions?.create({ customName: "Handle click" });
// This would normally create an automatic user action that interrupts this manual user action.
await router.redirect("home");
userAction.complete();
}
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.completeAutomatically = false;
// Execute some requests or mutations, then complete the user action
userAction.complete();
});
// Some time later if you don't want to listen to userActions anymore
unsubscribe();
Creates a new controllable user action.