Hello community.
I can`t add JavaScript variable in user tag rule with message "Not supported JavaScript expression"
Why i can`t use JS variables from local storage?
I have no cookies, CSS selector with username. I have only this JS value. Is there any workaround without JS dtrum sdk with dtrum.identify.... to use this value?
Regards,
Alexander
With google you can easily search for how to list all global JS variables in Chrome console.
eg. you can run
for(var b in window) {
if(window.hasOwnProperty(b)) console.log(b);
}
as page below sugggest
https://stackoverflow.com/questions/2934787/view-list-of-all-javascript-variables-in-google-chrome-console
Then use the value you need in Dynatrace
Please mind only global variables are accessible.
Hello Janusz,
My question is not "HOW". My question is "WHY it is not possible to use this value"
I use this:
(function () { var keys=Object.keys( window ); for (var i in keys) { if (typeof window[keys[i]] != 'function') console.log(keys[i], window[keys[i]]); } })(); |
I have see this value and can call from web browser console. After cleanup rules (cut usernames and symbols (.:") i will have correct login.
Regards,
Alexander
Answer by Janusz D. ·
So explanation.
Variable name contained dash so in Chrome console - format as below
localStorage.__Sxxe-Sxxxxxx-RxxxxxxService_Sxxx_Sxxxxx_RxxxxxxyService
did not work
in Chrome console - format as below
localStorage["__Sxxe-Sxxxxxx-RxxxxxxService_Sxxx_Sxxxxx_RxxxxxxyService"]
returned requested value.
Fortunatelly syntax
localStorage.__Sxxe-Sxxxxxx-RxxxxxxService_Sxxx_Sxxxxx_RxxxxxxyService
worked in Dynatrace despite dashes.
Janusz provided me solution as:
In browser console the call executed with error but in Dynatrace we have successfully defined userlogins.
Big thanks to Janusz.
Regards,
Alexander
Answer by Alexander S. ·
Have you tried: localStorage.<variableName>?
Hello Alexander
I can`t call localStorage.<variableName>, but i can cal localStorage["some"] - 2 string on screenshot.
You can see localStorage call in browser console on screenshot below:
Can i use localStorage variable with cleanup rules? Will it works?
Regards,
Alexander
DECEMBER 12, 10:00 AM GMT / 2:00 PM ET
Learn how Dynatrace Real User Monitoring automatically detects errors that impact your end users caused by erroneous 3rd party or CDNs.
December 10, 4:00 pm CET / 10:00 am ET
Register here
Learn how Dynatrace Real User Monitoring automatically detects errors that impact your end users caused by erroneous 3rd party or CDNs.
December 10, 4:00 pm CET / 10:00 am ET
Register here
Learn how Dynatrace Real User Monitoring automatically detects errors that impact your end users caused by erroneous 3rd party or CDNs.
December 10, 4:00 pm CET / 10:00 am ET
Register here
offtopic - Dynatrace is Gartner APM 2019 leader 2 Answers
Trying to do RUM injection but receiving an odd response from the 'rb' POST 1 Answer
Is there time line for USQL to support where with regular expressions or LIKE? 1 Answer
Limit on data sent through POST call to Dynatrace Server by RUM JavaScript 0 Answers
Is the cookie of RUM saved for each domain? And Is there any related settings? 2 Answers