I am trying to capture User Action using addAction, addActionProperty, leaveAction, however the addActionProperty does not work, though I created Javascript Variable for the properties i am passing in addActionProperty.
How did I create;
Click on Application > Edit > Capturing > Session and action Properties > Add Property > Custom defined property.
And then I chose Javascript Variable put other details.
My code below;
const dtrum = window?.dtrum;
if (!dtrum) {
logger.info(`trackCustomUserAction (dtrum API undefined) actionName=[${actionName}] `);
return;
}
const actionId = dtrum.enterAction('feature_initialized’);
if (properties && typeof dtrum.addActionProperties === ‘function’) {
dtrum.addActionProperties(actionId, null, null, {status, action});
}
dtrum.leaveAction(actionId);
So when my code is executed the values does not seems to be logged in dynatrace.
However, if i set property values in global windows then Dynatrace UI grabs the value and logs the status and action for the user. Below ithe working code
const actionId = dtrum.enterAction('feature_initialized’);
//Created Javascript variable in Session and User Property
// capture expression named as DT_OBSERVABILITY
// assigning it in global window, so that dynatrace UI could capture value
window.POC = window.POC || {};
window.POCstatus = values?.status ?? ‘’;
window.POC.action = values?.action ?? ‘’;
dtrum.leaveAction(actionId);
I am trying to understand why addActionProperty does not work, is it related to Our Dynatrace tenant runs on RUM Classic Gen2 without DPS licensing. I see that we do not have experience vital and user events available. Could someone help clarify as I need to document this as I am trying to log user actions in our web application