User session property from Session storage values

Hello,

I have to extract business insights from user sessions as user session properties. Data is stored on Storage session in a key named currentStore :

Inspiring by the @Julius_Loman 's RFE https://community.dynatrace.com/t5/Product-ideas/Browser-Local-Storage-or-Session-Storage-values-for-properties/idi-p/176668 , I use the type javascript variable sessionStorage.currentStore

I am able to catch the value but in my case it’s a json content so I have to execute a cleaning rule to keep only the id or name values :

From a performance perspective, is it possible to parse the JSON directly to extract only the id and name values ?

I tried to configure like below but it didn’t work :

Thank you.

Regards Aurélien.

Very good question! I’d love to find out too:)

@AurelienGravier what about cleanup rule? You need to use regex, so … it’s not exactly parsing a JSON, but the following should work for you:

"id":\s*+"(\d*+)"
"name":\s*+"([^"]*+)"

@Julius_Loman it works but It would be a more sustainable because : 
- the string length capture is limited to 1000 first char :

- if I select 1000 it consumes like 10 properties :

My cleanup rules :

id":“([^”]*+)

and

name":“([^”]*+)

Well, in such cases, I really recommend sending the properties using RUM JS API instead and you won’t need to capture a lengthy string which will be cleaned down to few characters.

Hi @AurelienGravier ,

Now from RUM JS version 1.295 we can use session storage JSON key values individually as mentioned in this documentation: Define user action and user session properties for web applications in RUM Classic — Dynatrace Docs

For example:- In your case sessionStorage.currentStore.$id, sessionStorage.currentStore.$storeName

Regards,

Ajay Naidu

Hello @anaidu it’s a good news thank you for your feeback 👍