cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

User session property from Session storage values

AurelienGravier
DynaMight Champion
DynaMight Champion

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 :

AurelienGravier_2-1698917768391.png

 

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

AurelienGravier_5-1698918063558.png

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 :

AurelienGravier_4-1698918004620.png

 

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 :

AurelienGravier_7-1698925325242.png

 

Thank you.

Regards Aurélien.

Observability consultant - Dynatrace Associate/Pro/Services certified
4 REPLIES 4

radek_jasinski
DynaMight Guru
DynaMight Guru

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

Have a nice day!

Julius_Loman
DynaMight Legend
DynaMight Legend

@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*+"([^"]*+)"

 

Certified Dynatrace Master | Alanata a.s., Slovakia, Dynatrace Master Partner

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

AurelienGravier_0-1698927810799.png

- if I select 1000 it consumes like 10 properties :

AurelienGravier_1-1698927926413.png

 

 

My cleanup rules :

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

and

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



Observability consultant - Dynatrace Associate/Pro/Services certified

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.

Certified Dynatrace Master | Alanata a.s., Slovakia, Dynatrace Master Partner

Featured Posts