# User Tagging with XHR request payload

**URL:** <https://community.dynatrace.com/t/user-tagging-with-xhr-request-payload/12713>\
**Category:** Real User Monitoring\
**Tags:** real-user-monitoring-classic, user-sessions\
**Created:** [June 15, 2018, 12:32pm UTC](https://community.dynatrace.com/t/user-tagging-with-xhr-request-payload/12713 "2018-06-15T12:32:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![matt\_evanson1](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/matt_evanson1/32/23494_2.png) [@matt\_evanson1](https://community.dynatrace.com/u/matt_evanson1)\
**Post date:** [June 15, 2018, 12:32pm UTC](https://community.dynatrace.com/t/user-tagging-with-xhr-request-payload/12713/1 "2018-06-15T12:32:35Z")

</div>

Can we use XHR request payload values for user name taggin? If so, what would the configuration look like? Thanks

---

<div class="post-metadata">

**Author:** ![franz\_soengen](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/franz_soengen/32/21806_2.png) [@franz\_soengen](https://community.dynatrace.com/u/franz_soengen)\
**Post date:** [June 15, 2018, 12:39pm UTC](https://community.dynatrace.com/t/user-tagging-with-xhr-request-payload/12713/2 "2018-06-15T12:39:39Z")

</div>

Hi Matthew,

if the user name is loaded into a JavaScript Variable you may be able to retrieve it from there.

 ![17167-2018-06-15-14-39-53-user-identifier-dynatrace-demo.png](https://global.discourse-cdn.com/dynatrace/original/3X/2/5/2543b24c815c7da2cfa1119b608686b27647da8e.png)

Another possibility is using the JavaScript API and calling dtrum.identifyUser() after the request.

best regards

Franz

 ![2018-06-15-14-37-47-user-identifier-dynatrace-demo.png](https://global.discourse-cdn.com/dynatrace/original/3X/1/8/18f4d124958c42c63d2dec0adee2be8b0bb2def7.png)

---

<div class="post-metadata">

**Author:** ![matt\_evanson1](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/matt_evanson1/32/23494_2.png) [@matt\_evanson1](https://community.dynatrace.com/u/matt_evanson1)\
**Post date:** [June 15, 2018, 12:47pm UTC](https://community.dynatrace.com/t/user-tagging-with-xhr-request-payload/12713/3 "2018-06-15T12:47:15Z")

</div>

Would this be considered a JavaScript Variable?

 ![17169-usertagging-example.jpg](https://global.discourse-cdn.com/dynatrace/original/3X/6/2/6280cd06602920aab0cb11d30c140c6abf26c12a.jpeg)

---

<div class="post-metadata">

**Author:** ![franz\_soengen](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/franz_soengen/32/21806_2.png) [@franz\_soengen](https://community.dynatrace.com/u/franz_soengen)\
**Post date:** [June 15, 2018, 1:55pm UTC](https://community.dynatrace.com/t/user-tagging-with-xhr-request-payload/12713/4 "2018-06-15T13:55:16Z")

</div>

Which kind of Storage is this? It looks like Local or Session Storage. That is of course accessible by Javascript functions but I don’t think Dynatrace accepts a function call here.

---

<div class="post-metadata">

**Author:** ![pahofmann](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/pahofmann/32/17076_2.png) [@pahofmann](https://community.dynatrace.com/u/pahofmann)\
**Post date:** [June 20, 2018, 2:37pm UTC](https://community.dynatrace.com/t/user-tagging-with-xhr-request-payload/12713/5 "2018-06-20T14:37:14Z")

</div>

Unfortunately you can’t use the payload of an XHR Request for tagging.

If the value is not available via a CSS selector, Cookie, JavaScript variable or a Meta Tag, the only way is to use the JavaScript API to set the user tag. If you choose that route be sure to evalute if the agent is loaded before performing the call to identify the user.
