20 Nov 2023 10:03 AM
Hi,
I am trying to find out more about session and action property.
Understand that for web application, there is RUM JavaScript API for me to add session and action property through sendSessionProperties and addActionProperties().
And for mobile, i can use reportValue.
Hence i would like to ask if they function the same way?
Adding Session Property
var js_role = { js_role: "staff" };
window.dtrum.sendSessionProperties(null, null, js_role);
Dynatrace.reportStringValue("js_role", "staff");
Add Action Property
var rating;
function submitForm(value) {
fetch('https://example.com/submit')
.then(response => response.json())
.then(data => {
if (typeof dtrum === "undefined") return;
// Add Action Listener
rating = { js_rating: value };
window.dtrum.addEnterActionListener(addRatingToAction);
// Add Custom Action
var submtitForm = window.dtrum.enterAction('Submit Form');
window.dtrum.leaveAction(submtitForm);
// Remove Action Listener
window.dtrum.removeEnterActionListener(addRatingToAction);
})
.catch(error => {
console.error('API Error:', error);
});
}
// Add Action Properties
function addRatingToAction(actionId) {
window.dtrum.addActionProperties(actionId, null, null, rating);
}
let myAction = Dynatrace.enterAutoAction("Submit Form");
myAction.reportStringValue("js_rating", value);
myAction.leaveAction();
- is this correct?
Thanks.
Solved! Go to Solution.
20 Nov 2023 10:51 AM
Hi @Weilin1
In general, sendSessionProperties and addActionProperties in web applications and reportValue in mobile applications serve a similar purpose of enriching session and action data with custom properties, they are tailored to the specific requirements and best practices of web and mobile platforms respectively.
Radek
20 Nov 2023 11:25 AM
Just for the record - for web apps, you won't see any values until properties are configured for the web application in Dynatrace. For mobile applications it's different, you will still see the values in user action waterfall screens (very convenient and useful), and they will act as user action property just after you defined them. That's why the difference - sendActionProperties vs. reportValue.