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.
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.
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.
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.
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:
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.
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.