19 Feb 2020
01:23 AM
- last edited on
26 Apr 2021
03:39 AM
by
MaciejNeumann
Hi,
follow the instruction here: https://www.dynatrace.com/support/help/how-to-use-dynatrace/real-user-monitoring/how-to-use-real-use...
For your case it seems CSS selector: ".profile-link-label" should work.
I tried but did not receive
You have to wait few minutes to have it. Before whole session will be tagged you will be able to see tag event inside particular user sessions.
Sebastian
To verify if it works you can execute the following javascript code in browser's Console:
document.querySelector(".profile-link-label");
As a result you should get a HTML DOM element with the username inside. Otherwise you will receive "null". It may happen that the element you are looking for is typically hidden until e.g. user menu is opened, thus cannot be fetched by OneAgent at start.
Not the same The value still depends on Anonymous.
Sebastian
I cleared the cookies but I haven't
I'm not asking about clearing cookies, application sometimes is storing user id in cookies.
Sebastian
May I have a way to add a user tag using cookies?
what was the result of that script I provided?
still the same.
The easiest way to capture a CSS Selector is to go to the webpage via chrome, and highlight the text you want to capture. Once highlighted, right click and select inspect. This will take you directly to the code level that supply's the highlighted entity. Right click that entity and copy the selector.
You can toss it into notepad for the time being and then create the application tag within the desired application in Dynatrace.
I recommend writing down the time when you save the change in your Dynatrace Application. It takes about 30 mins for new sessions to show up within the User Sessions Page. You yourself can access your application and create your own user session and see if it keys off on you. Just keep in mind there could be a delay. And always make sure you close out of the webpage when you are done or clear out the cookies. Just remember of the delay, if you dont see sessions right away, give it some time.
Let me know if you have any issues.
-Chad
didn't still the same
Extra question, you have OneAgent installed on this application or it is Agentless rum monitoring? If this is agentless rum monitoring, changing configuration may need upgrade snippet implemented inside this page. If you used dynatrace cdn, configuration is refreshing within hour.
Sebastian
not install Agent.
What is your snippet configuration in Application settings?
install for this picture
Ok so in such case application configuration should be refreshing almost instantly (there is API url for that case as well for SaaS and Managed version -> via cluster active gate of Dynatrace). In such case you should check @Radoslaw S. suggestion and past this in browser console on page where you are trying to extract user name:
document.querySelector(".profile-link-label");
If you will receive value you need without problems it has to work as well for application in DT. If you will receive null, it means that this will not work because of page specification.
Sebastian
I'd like to ask, If the front page is like a list menu, so can I get null?
We've just saw it on a customer site. The value on this portion of the page is only loaded when the user is clicking on the icon, hence the unless it is really happening, the user tagging rule you're trying to do will not work.
What we saw on our specific implementation that when a user reaches the homescreen of the application, it is also displaying his user name as part of the page (something like "showing content as USERNAME" for example. This had its own css selector that is working assuming the users are reaching this page.
Featured Posts