# Setting and retrieving User Session Property values via JS API?

**URL:** <https://community.dynatrace.com/t/setting-and-retrieving-user-session-property-values-via-js-api/20142>\
**Category:** Real User Monitoring\
**Tags:** request-attributes, user-sessions, javascript\
**Created:** [March 26, 2019, 1:37pm UTC](https://community.dynatrace.com/t/setting-and-retrieving-user-session-property-values-via-js-api/20142 "2019-03-26T13:37:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeff\_rowell](https://avatars.discourse-cdn.com/v4/letter/j/779978/32.png) [@jeff\_rowell](https://community.dynatrace.com/u/jeff_rowell)\
**Post date:** [March 26, 2019, 1:37pm UTC](https://community.dynatrace.com/t/setting-and-retrieving-user-session-property-values-via-js-api/20142/1 "2019-03-26T13:37:00Z")

</div>

I have a requirement to pass the numeric ID returned from the _DTRUM.enterAction_ method that is being called in a logon web page provided by one of our  
authentication systems to a web page of another system. Since there is no way  
for us to pass the value via a cookie, JS variable etc. without making  
extensive system changes, I am hoping that use can be made of the new User  
Session Properties features of version 164. Whether this is going to be possible,  
however, isn’t clear to me from the documentation.

I can  
see that DTRUM provides a _send __Session__ Properties_  
method that, I suspect, could be used to add the numeric ID to the user  
session (?), but I am not clear whether Dynatrace provides any mechanism that would  
allow the JS in our destination web page to retrieve the value. Looking at the  
DTRUM documentation I don’t see any such capability. Can anyone clarify whether  
we can achieve what we want using a User Session variable? What I had hoped to  
do is illustrated by the following:

// **Step 1** – In web page of the user authentication  
system call dtrum.enterAction to start a custom user action

LogonTimerAction = dtrum.enterAction(‘Logon Time’, ‘LogonTimer’,  
null, ‘info’);

//  
**Step 2** – In web page of the user authentication, put the return value of the  
above API call into a User Session Property via the sendSessionProperties  
API (?)

//  
**Step 3** – In the destination systems web page, retrieve the variable from the  
user session attribute.

//  
**Step 4** – In the destination systems web page, pass the variable to  
dtrum.leaveAction to close the action and obtain its timing.

dtrum.leaveAction(LogonTimerAction);

More generally,  
can you tell me where I can find detailed documentation for the Session  
properties configuration options? I see “JavaScript API” as an “Expression type”  
that can be selected, but I am unable to find any documentation of what this  
represents or how to configure it. Similarly, I understand that we can set session  
properties using request attributes, but I cannot find documentation of how to  
configure a session attribute using a request attribute.

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [March 27, 2019, 7:38am UTC](https://community.dynatrace.com/t/setting-and-retrieving-user-session-property-values-via-js-api/20142/2 "2019-03-27T07:38:02Z")

</div>

As far as I know, there is no option to retrieve any user session property values from the dtrum js api. User session properties can be only set in dtrum. The architecture of beacons is “send only”. Session data are processed on the server.

I’m afraid you will have to find another solution using cookie seems to be a straightforward idea.

Values of user session properties can be only used within session analysis (you can filter on them or display them). Also, they can be used in USQL queries as well.

More on this topic in [this blog post](https://www.dynatrace.com/news/blog/filter-user-sessions-based-on-custom-session-properties-eap/).
