# CSS selector for user tagging trouble incl GT or spaces

**URL:** <https://community.dynatrace.com/t/css-selector-for-user-tagging-trouble-incl-gt-or-spaces/31838>\
**Category:** Real User Monitoring\
**Tags:** real-user-monitoring-classic, user-sessions\
**Created:** [June 17, 2021, 8:13am UTC](https://community.dynatrace.com/t/css-selector-for-user-tagging-trouble-incl-gt-or-spaces/31838 "2021-06-17T08:13:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![RayT](https://avatars.discourse-cdn.com/v4/letter/r/3be4f8/32.png) [@RayT](https://community.dynatrace.com/u/RayT)\
**Post date:** [June 17, 2021, 8:13am UTC](https://community.dynatrace.com/t/css-selector-for-user-tagging-trouble-incl-gt-or-spaces/31838/1 "2021-06-17T08:13:35Z")

</div>

Does the User Tag, CSS selector handle the greater than sign &/or spaces?

My experience is that it doesn’t OR I just cannot get the right selector value.

A value of:&nbsp;#pgl60\>span.pt-header-right-user with/without spaces " \> "

Results in this in the header:&nbsp;md=mdcc1=a#pgl60^rbspan.pt-header-right-user or with/without spaces " ^rb "

Whether that is interpreted by the Dyna JS properly & also whether that is why the user tagging fails or not I’m not sure but I have tried all the following:

| #pgl60.flex.af\_panelGroupLayout@innerText |
| --- |
| #pgl60%3Espan.pt-header-right-user |
| #pgl60\>span.pt-header-right-user |
| #pgl60%E3;span.pt-header-right-user |
| #pgl60\>span.pt-header-right-user |
| #pgl60&gtspan.pt-header-right-user |
| #pgl60\>span.pt-header-right-user@innerText |

For this html

![RayT_0-1623916829612.png](https://global.discourse-cdn.com/dynatrace/original/2X/c/cc2c6e26defc081cdface7a5b6a81da79098cf5f.png)

I’ve even tried straight #pgl60 since in Chrome tools it’s innerText is the user value I’m after.

Similarly note that top attempt, refers to the pgl60 parent with no sub selector&nbsp;“\>”

- again since the value does actually come up in Chrome as innerText of that parent.

The expected #pgl60, #pgl60\>span.pt-header-right-user&nbsp; both work fine in the Chrome DEV console

eg: $$(“#pgl60\>span.pt-header-right-user”)

I “think” one of those might actually have worked but due to the delay when testing I don’t know which - trying to work that out now & have turned on session replay just to see if I can analyze html afterwards. In the meantime any tips from the learned might be helpful.

Cheers

RT

---

<div class="post-metadata">

**Author:** ![ChadTurner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/chadturner/32/161_2.png) [@ChadTurner](https://community.dynatrace.com/u/ChadTurner)\
**Post date:** [June 17, 2021, 8:28pm UTC](https://community.dynatrace.com/t/css-selector-for-user-tagging-trouble-incl-gt-or-spaces/31838/2 "2021-06-17T20:28:33Z")

</div>

from my experience, it does. grabbing that tag value can be quite a hassle. I typically find the target, then highlight it, inspect, then right click and copy the selector value. keep in mind it could take a while for new data to show up. and if you dont delete your older rule, make sure you move your new rule up to the top of the list.

I’d inspect the span class on the next line and give that a go.

---

<div class="post-metadata">

**Author:** ![RayT](https://avatars.discourse-cdn.com/v4/letter/r/3be4f8/32.png) [@RayT](https://community.dynatrace.com/u/RayT)\
**Post date:** [June 18, 2021, 12:31am UTC](https://community.dynatrace.com/t/css-selector-for-user-tagging-trouble-incl-gt-or-spaces/31838/3 "2021-06-18T00:31:25Z")

</div>

Thanks for that. Well the verbatim copy selector in Chrome is “#pgl60 \> span”

So I will give that a shot & leave it for a good while before deciding success or failure.

Cheers

---

<div class="post-metadata">

**Author:** ![RayT](https://avatars.discourse-cdn.com/v4/letter/r/3be4f8/32.png) [@RayT](https://community.dynatrace.com/u/RayT)\
**Post date:** [June 21, 2021, 2:13am UTC](https://community.dynatrace.com/t/css-selector-for-user-tagging-trouble-incl-gt-or-spaces/31838/4 "2021-06-21T02:13:47Z")

</div>

Got a feeling now it might be iframe related.&nbsp; I see the following in the html

\<script … data-dtconfig="…|md=mdcc1=a#pgl60 ^rb span@innerText||ssv=4|lastModification=1623994683482…\</script\>

Then later in an iframe

\<iframe name=“afr::PushIframe” id=“afr::PushIframe” style=“display:none” src=“/portal/afr/blank.html”\>  
…  
\<script … data-dtconfig=“…|md=mdcc1=apg160|ssv=4|lastModification=1623810190706…”\>\</script\>

So in the 2 dtconfig - different lastMod but same app… & that 2nd one in the iframe wouldn’t be valid no doubt - no # …&nbsp; ^^ ???

arrgh

---

<div class="post-metadata">

**Author:** ![Cordelia25](https://avatars.discourse-cdn.com/v4/letter/c/e9c0ed/32.png) [@Cordelia25](https://community.dynatrace.com/u/Cordelia25)\
**Post date:** [June 21, 2021, 4:36am UTC](https://community.dynatrace.com/t/css-selector-for-user-tagging-trouble-incl-gt-or-spaces/31838/5 "2021-06-21T04:36:11Z")

</div>

It’s reasonable to use an attribute selector is when the attribute is meaningful and related to why you want to pick that element, and not arbitrary. For example, if you want to add padding to all of your range inputs (\<input type=“range”\>, this is great: input[type=range] { padding: 4px; } It’s usually not worth adding an additional class like class=“slider” to all of those elements, because you can already uniquely select for them. On the flip side, suppose you had a \<iframe src=“ad.html”\>. In theory, you could select for that iframe using iframe[src=“ad.html”], but that’d be a terrible idea, because if you ever changed the url you’d have to update the CSS too. That’s a case where clearly a class or id is better.

[myaarpmedicare.com](https://www.myaarpmedicare.work/)
