# Configure CSS Selectors for Dynatrace User Tagging

**URL:** <https://community.dynatrace.com/t/configure-css-selectors-for-dynatrace-user-tagging/11209>\
**Category:** Real User Monitoring\
**Tags:** real-user-monitoring-classic, user-sessions\
**Created:** [March 8, 2018, 2:02am UTC](https://community.dynatrace.com/t/configure-css-selectors-for-dynatrace-user-tagging/11209 "2018-03-08T02:02:35Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christopher\_Cha](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/christopher_cha/32/26178_2.png) [@Christopher\_Cha](https://community.dynatrace.com/u/Christopher_Cha)\
**Post date:** [March 8, 2018, 2:02am UTC](https://community.dynatrace.com/t/configure-css-selectors-for-dynatrace-user-tagging/11209/1 "2018-03-08T02:02:35Z")

</div>

_Summary:&nbsp;The post shows how to create CSS selector rules to capture usernames or IDs in Dynatrace RUM. It includes tips for validating selectors and ensuring consistent tag extraction._

Hey guys,

I’m in the midst of deploying Dynatrace Managed for a customer, and I’m not really familiar with the CSS part for user tagging. We have identified the CSS element that contains the user name, but I’m just not too sure if the configuration is correct. Could you help me verify?

Attached is a screenshot, and the highlighted part is the user name we want to capture. Would “ **#navTabButtonUserInfoText navTabButtonUserInfoWorker@title** ” work? As I will not be on-site until next week and the customer is new to the product, I’d just thought of getting opinions here first…

Chris

 ![16059-capture.jpg](https://global.discourse-cdn.com/dynatrace/original/3X/4/f/4f60e4c33558c3f3eaadf8d16a5be1bd80218e3d.jpeg)

---

<div class="post-metadata">

**Author:** ![gautier\_begin](https://avatars.discourse-cdn.com/v4/letter/g/e36b37/32.png) [@gautier\_begin](https://community.dynatrace.com/u/gautier_begin)\
**Post date:** [March 8, 2018, 7:05am UTC](https://community.dynatrace.com/t/configure-css-selectors-for-dynatrace-user-tagging/11209/2 "2018-03-08T07:05:31Z")

</div>

Chris,

First, capture the correct CSS selector by selecting your element from the WebGUI, then click right and select Inspect. You have this option in Chrome and Firefox, not in IE.

 ![16060-bphdm.png](https://global.discourse-cdn.com/dynatrace/original/2X/2/28e4d75e278b6c73eadc94a5e961a25816449960.png)

Then in the HTML editor, click on “copy as CSS”, past in Dynatrace and that’s done

 ![16062-tbbon.png](https://global.discourse-cdn.com/dynatrace/original/3X/2/c/2c293b9502472451871b609762ce6bb5e349fda4.png)

In some cases, that may not be sufficient because you are capturing extra characters or strings. Then use a regex that you will put under the “Apply cleanup rule” option in the “User tag” rule of your Dynatrace application.

You can also have a look here:

> **[Tag specific users for web applications in RUM Classic](https://docs.dynatrace.com/docs/observe/digital-experience/rum-classic/web-applications/additional-configuration/identify-individual-users-for-session-analysis)**
>
> Tag individual users via the JavaScript API for session analysis.

Regards,

---

<div class="post-metadata">

**Author:** ![dave\_mauney](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/dave_mauney/32/27784_2.png) [@dave\_mauney](https://community.dynatrace.com/u/dave_mauney)\
**Post date:** [March 11, 2018, 10:37pm UTC](https://community.dynatrace.com/t/configure-css-selectors-for-dynatrace-user-tagging/11209/3 "2018-03-11T22:37:53Z")

</div>

Hi Chris,

Here’s a brief step-by-step PowerPoint that may help also, especially if you want to test the CSS selector before you add it to Dynatrace:

[https://dynatrace-my.sharepoint.com/:p:/p/dave\_mau…](https://dynatrace-my.sharepoint.com/:p:/p/dave_mauney/EUDytJI2bnlEhcQ5s921GFgBHT1VsnVqBH5wTzT2orD_eQ?e=TfN5N0)

HTH,

dave

---

<div class="post-metadata">

**Author:** ![Christopher\_Cha](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/christopher_cha/32/26178_2.png) [@Christopher\_Cha](https://community.dynatrace.com/u/Christopher_Cha)\
**Post date:** [March 12, 2018, 6:14am UTC](https://community.dynatrace.com/t/configure-css-selectors-for-dynatrace-user-tagging/11209/4 "2018-03-12T06:14:27Z")

</div>

Thanks guys! The one that worked is **#navBarUserInfoTextId \> span.navTabButtonUserInfoText.navTabButtonUserInfoWorker**.

---

<div class="post-metadata">

**Author:** ![DavidePiras](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/davidepiras/32/29341_2.png) [@DavidePiras](https://community.dynatrace.com/u/DavidePiras)\
**Post date:** [October 4, 2019, 11:34am UTC](https://community.dynatrace.com/t/configure-css-selectors-for-dynatrace-user-tagging/11209/5 "2019-10-04T11:34:30Z")

</div>

Great thanks for sharing this Chris, very helpful for user tagging in MS Dynamics!

---

<div class="post-metadata">

**Author:** ![\_r\_k](https://avatars.discourse-cdn.com/v4/letter/_/3d9bf3/32.png) [@\_r\_k](https://community.dynatrace.com/u/_r_k)\
**Post date:** [December 11, 2019, 3:15pm UTC](https://community.dynatrace.com/t/configure-css-selectors-for-dynatrace-user-tagging/11209/6 "2019-12-11T15:15:33Z")

</div>

just to clear details:

to get value of attribute title it should be:

**#navBarUserInfoTextId \> span.navTabButtonUserInfoText.navTabButtonUserInfoWorker** @title

---

<div class="post-metadata">

**Author:** ![Peter\_Youssef](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/peter_youssef/32/14668_2.png) [@Peter\_Youssef](https://community.dynatrace.com/u/Peter_Youssef)\
**Post date:** [January 8, 2023, 12:35pm UTC](https://community.dynatrace.com/t/configure-css-selectors-for-dynatrace-user-tagging/11209/7 "2023-01-08T12:35:11Z")

</div>

Hi&nbsp;[@dave\_mauney](https://community.dynatrace.com/user/771)

Can you please share this PPT again as I’ve tried to access it, I find It’s expired.

Thanks.

---

<div class="post-metadata">

**Author:** ![dave\_mauney](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/dave_mauney/32/27784_2.png) [@dave\_mauney](https://community.dynatrace.com/u/dave_mauney)\
**Post date:** [January 9, 2023, 3:03pm UTC](https://community.dynatrace.com/t/configure-css-selectors-for-dynatrace-user-tagging/11209/8 "2023-01-09T15:03:10Z")

</div>

I shared it again here:

[HowToSpecifyUserTagCSSSelector.pptx](https://dynatrace-my.sharepoint.com/:p:/p/dave_mauney/EUDytJI2bnlEhcQ5s921GFgBViRIgcwsdr8UVFdBbP2O8Q?e=L9iEN0)

Our corporate policy is to set a 90 expiration on links shared on SharePoint, so the clock starts again now…

---

<div class="post-metadata">

**Author:** ![anders\_lundin](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/anders_lundin/32/7684_2.png) [@anders\_lundin](https://community.dynatrace.com/u/anders_lundin)\
**Post date:** [April 28, 2023, 12:45pm UTC](https://community.dynatrace.com/t/configure-css-selectors-for-dynatrace-user-tagging/11209/9 "2023-04-28T12:45:34Z")

</div>

[@dave\_mauney](https://community.dynatrace.com/user/771)&nbsp;Could I ask you to share again please?

---

<div class="post-metadata">

**Author:** ![dave\_mauney](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/dave_mauney/32/27784_2.png) [@dave\_mauney](https://community.dynatrace.com/u/dave_mauney)\
**Post date:** [April 28, 2023, 1:10pm UTC](https://community.dynatrace.com/t/configure-css-selectors-for-dynatrace-user-tagging/11209/10 "2023-04-28T13:10:06Z")

</div>

[HowToSpecifyUserTagCSSSelector.pptx](https://dynatrace-my.sharepoint.com/:p:/p/dave_mauney/Ea93JIlJIvxAjnTib8vjeVgBAUhcM5fwQZfkHoJQMPuGxg?e=mvdCFa)&nbsp;(expires July 27th, 2023)

---

<div class="post-metadata">

**Author:** ![DavidePiras](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/davidepiras/32/29341_2.png) [@DavidePiras](https://community.dynatrace.com/u/DavidePiras)\
**Post date:** [May 25, 2023, 8:46pm UTC](https://community.dynatrace.com/t/configure-css-selectors-for-dynatrace-user-tagging/11209/11 "2023-05-25T20:46:05Z")

</div>

This is not working anymore on latest version 9.1.x of MS Dynamics 365 on prem.

---

<div class="post-metadata">

**Author:** ![rohan1shah](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/rohan1shah/32/35394_2.png) [@rohan1shah](https://community.dynatrace.com/u/rohan1shah)\
**Post date:** [June 1, 2023, 8:40pm UTC](https://community.dynatrace.com/t/configure-css-selectors-for-dynatrace-user-tagging/11209/12 "2023-06-01T20:40:12Z")

</div>

Hello, I am trying to extract the name John for user tagging using CSS selector.

```markup
<a _ngcontent-sba-c1="" aria-label="My Profile" class="user-label ng-star-inserted" href="ABCD"><span _ngcontent-sba-c1="" class="check-dirty user-name">Hello, John</span><img _ngcontent-sba-c1="" alt="user" class="check-dirty user-profile" src="XYZ.svg"></a>

```

I followed the same instructions to copy the selector and this is what I input into the app config for user tagging. It still keep the User names in sessions as Anonymous:

```css
#page-main-container > div.bmo-container > div:nth-child(1) > a > span

```

Am I missing something here which is not letting the user tag parse through?

---

<div class="post-metadata">

**Author:** ![dave\_mauney](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/dave_mauney/32/27784_2.png) [@dave\_mauney](https://community.dynatrace.com/u/dave_mauney)\
**Post date:** [June 1, 2023, 9:12pm UTC](https://community.dynatrace.com/t/configure-css-selectors-for-dynatrace-user-tagging/11209/13 "2023-06-01T21:12:24Z")

</div>

Did you test the selector in the dev tools console as covered in the PPT above?&nbsp; I am no CSS expert, but you might want to try a selector of “.check-dirty user-name” and see if that works should be less “brittle” than the selector you are trying now.

---

<div class="post-metadata">

**Author:** ![rohan1shah](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/rohan1shah/32/35394_2.png) [@rohan1shah](https://community.dynatrace.com/u/rohan1shah)\
**Post date:** [June 2, 2023, 4:11pm UTC](https://community.dynatrace.com/t/configure-css-selectors-for-dynatrace-user-tagging/11209/14 "2023-06-02T16:11:56Z")

</div>

Yes I did test it, I get NULL as a response for some reason. Couldn’t understand why:

 ![rohan1shah_0-1685722310433.png](https://global.discourse-cdn.com/dynatrace/original/3X/c/5/c5985ddc3b32b327211728dd1ce8feeba1d84625.png)

---

<div class="post-metadata">

**Author:** ![rohan1shah](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/rohan1shah/32/35394_2.png) [@rohan1shah](https://community.dynatrace.com/u/rohan1shah)\
**Post date:** [June 2, 2023, 4:48pm UTC](https://community.dynatrace.com/t/configure-css-selectors-for-dynatrace-user-tagging/11209/15 "2023-06-02T16:48:06Z")

</div>

Update - This seems to work -

```javascript
document.querySelector("span.check-dirty.user-name").innerHTML

```

![rohan1shah_0-1685724386510.png](https://global.discourse-cdn.com/dynatrace/original/3X/c/5/c5f859a09407733cf825bce3381e01f45b4d1872.png)

But when I input that as part of the User Tagging Rules, there still seems to be no change. All sessions show up as anonymous:

 ![rohan1shah_2-1685724472567.png](https://global.discourse-cdn.com/dynatrace/original/3X/a/0/a065fb2938f87030c317b898a5637c435bcabeff.png)

---

<div class="post-metadata">

**Author:** ![dave\_mauney](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/dave_mauney/32/27784_2.png) [@dave\_mauney](https://community.dynatrace.com/u/dave_mauney)\
**Post date:** [June 2, 2023, 4:54pm UTC](https://community.dynatrace.com/t/configure-css-selectors-for-dynatrace-user-tagging/11209/16 "2023-06-02T16:54:15Z")

</div>

And you are sure new logins have occurred after the change?

---

<div class="post-metadata">

**Author:** ![rohan1shah](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/rohan1shah/32/35394_2.png) [@rohan1shah](https://community.dynatrace.com/u/rohan1shah)\
**Post date:** [June 2, 2023, 4:59pm UTC](https://community.dynatrace.com/t/configure-css-selectors-for-dynatrace-user-tagging/11209/17 "2023-06-02T16:59:34Z")

</div>

Yes, I have been doing the logins myself and can see new sessions showing up from other users too in DT.

---

<div class="post-metadata">

**Author:** ![dave\_mauney](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/dave_mauney/32/27784_2.png) [@dave\_mauney](https://community.dynatrace.com/u/dave_mauney)\
**Post date:** [June 2, 2023, 5:15pm UTC](https://community.dynatrace.com/t/configure-css-selectors-for-dynatrace-user-tagging/11209/18 "2023-06-02T17:15:36Z")

</div>

The User Tag CSS selector “hint” says it will capture “innerText/textContent” so you may want to see what that gives in the console.

---

<div class="post-metadata">

**Author:** ![rohan1shah](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/rohan1shah/32/35394_2.png) [@rohan1shah](https://community.dynatrace.com/u/rohan1shah)\
**Post date:** [June 6, 2023, 7:34pm UTC](https://community.dynatrace.com/t/configure-css-selectors-for-dynatrace-user-tagging/11209/19 "2023-06-06T19:34:44Z")

</div>

Still unable to get any output.

 ![rohan1shah_0-1686080069455.png](https://global.discourse-cdn.com/dynatrace/original/3X/d/7/d78d0499ae9dbb29eb4e291435e96fef23aef08a.png)

---

<div class="post-metadata">

**Author:** ![dave\_mauney](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/dave_mauney/32/27784_2.png) [@dave\_mauney](https://community.dynatrace.com/u/dave_mauney)\
**Post date:** [June 7, 2023, 11:21am UTC](https://community.dynatrace.com/t/configure-css-selectors-for-dynatrace-user-tagging/11209/20 "2023-06-07T11:21:59Z")

</div>

I would try the in-product chat for some help. &nbsp;I am out of ideas.

[Next page](https://community.dynatrace.com/t/configure-css-selectors-for-dynatrace-user-tagging/11209.md?page=2)
