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

Session Propertiers

juanrergis
Contributor

I have a variable within my application that contains a Key and Value variable. How can I extract the variables to obtain this data from the user sessions? For example: the variable is called "offer." Inside it is a JSON file containing different variables at various levels, payments: 10. I want to obtain payments.
This is done in the session properties to obtain business data.

 

1 REPLY 1

Anderson-Luna
Dynatrace Enthusiast
Dynatrace Enthusiast

Hi if you're using RUM JavaScript version 1.295 or later, Dynatrace supports direct JSON parsing from session storage or JavaScript variables.

Example:

If your variable is:

{
  "offer": {
    "payments": 10,
    "details": {
      "currency": "USD"
    }
  }

And it's stored in sessionStorage.offer, you can extract payments like this:

  1. Go to Application Settings → Capturing → Session and action properties.
  2. Click Add property → Custom-defined property.
  3. Set:
    • Expression type: JavaScript variable
    • Key: offer_payments
    • Value: sessionStorage.offer.$payments

      The $ prefix tells Dynatrace to parse the value as JSON and extract the nested key payments.

If your variable is already a JSON string, use sessionStorage.offer.$payments. If it's a nested object, you can go deeper like sessionStorage.offer.$details.currency.

You can also check the official documentation for reference: https://docs.dynatrace.com/docs/shortlink/user-session-properties 



Featured Posts