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

Capturing Google Analytics data as User Action or Session Properties


We are looking to capture the total value of an order on the confirmation page. This is currently being sent to GA, so I thought it would be best if we can just re-use that data and store it in Dynatrace.

In the "Session and user action properties" config, if I select "Javascript Variable" and use the following:




It works, but the problem is that 13 is not always the right index.

The best way to get the right value is to run this, so the index can change every time, we just want the last instance of a purchase):


window.dataLayer.findLast((event) => event.event === "purchase").commerce.value


But that gives a message of "Not supported JavaScript expression!" when using the Javascript Variable option.


Is "Javascript function" the option that would work for the example? If so, does anyone know why that might be greyed out in the Dynatrace UI? Could it be because we are using Agentless RUM?




Dynatrace Pro
Dynatrace Pro

Hi @SG88 
Even if you are using Agentless monitoring, you need to add the RUM JavaScript to every HTML page of your application, in that case, you can use the RUM JavaScript API to customize the Real User Monitoring adding action/session properties. 

-César S. -

Thanks Cesar, we have the RUM JavaScript injected to each page but I usually try and avoid asking the devs to put in vendor specific code for monitoring.

If a code change is needed then I might just ask if they can put it into a more simple variable that we can read without needing to use a function in the "Session and user action properties" config.



Featured Posts