# Tagging within Response HTML

**URL:** <https://community.dynatrace.com/t/tagging-within-response-html/20776>\
**Category:** Real User Monitoring\
**Tags:** user-sessions\
**Created:** [November 10, 2020, 7:31pm UTC](https://community.dynatrace.com/t/tagging-within-response-html/20776 "2020-11-10T19:31:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bryan\_Bautista](https://avatars.discourse-cdn.com/v4/letter/b/7ab992/32.png) [@Bryan\_Bautista](https://community.dynatrace.com/u/Bryan_Bautista)\
**Post date:** [November 10, 2020, 7:31pm UTC](https://community.dynatrace.com/t/tagging-within-response-html/20776/1 "2020-11-10T19:31:35Z")

</div>

DyntraceONE - Can a tag be created from the following response html:

\<h2 class=“title”\>\<p class=“twolineerror” style=“color: red”\> **We’re sorry**

The goal is to capture “We’re sorry” or whatever value/message is contained within \<h2 class=“title”\>\<p class=“twolineerror” style=“color: red”\> and \</p\>\</h2\>

I was thinking this is possible with Regex but I don’t want to be greedy so as not to impact performance.

Any suggestions?

---

<div class="post-metadata">

**Author:** ![JamesKitson](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/jameskitson/32/22460_2.png) [@JamesKitson](https://community.dynatrace.com/u/JamesKitson)\
**Post date:** [November 10, 2020, 8:57pm UTC](https://community.dynatrace.com/t/tagging-within-response-html/20776/2 "2020-11-10T20:57:47Z")

</div>

True ‘tagging’ wouldn’t apply here. What you could do is define a user action or session property based on a CSS selector for that element and then you’d be able to track it a bit better with filters and USQL etc…

> **[Define user action and user session properties for web applications in RUM...](https://docs.dynatrace.com/docs/observe/digital-experience/rum-classic/web-applications/additional-configuration/define-user-action-and-session-properties)**
>
> Define custom string, numeric, and date properties for your monitored web applications.

Don’t worry too much about regular expression overhead because Dynatrace restricts how it can be used so it won’t let you use rules that are too inefficient greedy. In the config there’s a link to show you what is allowable.

---

<div class="post-metadata">

**Author:** ![Bryan\_Bautista](https://avatars.discourse-cdn.com/v4/letter/b/7ab992/32.png) [@Bryan\_Bautista](https://community.dynatrace.com/u/Bryan_Bautista)\
**Post date:** [November 11, 2020, 1:12pm UTC](https://community.dynatrace.com/t/tagging-within-response-html/20776/3 "2020-11-11T13:12:53Z")

</div>

Would adding a Custom Error Rule capture the same condition? If I’m trying to capture and identify those sessions with a “We’re sorry” message, a custom error rule might work in this case.

 ![27266-246611-10nov2020.png](https://global.discourse-cdn.com/dynatrace/original/2X/3/331c8dfecd639b6a514dff3d68a2dcae3a89cdf6.png)

---

<div class="post-metadata">

**Author:** ![JamesKitson](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/jameskitson/32/22460_2.png) [@JamesKitson](https://community.dynatrace.com/u/JamesKitson)\
**Post date:** [November 11, 2020, 3:30pm UTC](https://community.dynatrace.com/t/tagging-within-response-html/20776/4 "2020-11-11T15:30:16Z")

</div>

In order to use custom errors you need to actually report the error using the JavaScript API:

> **[Configure error detection for web applications in RUM Classic](https://docs.dynatrace.com/docs/observe/digital-experience/rum-classic/web-applications/additional-configuration/configure-errors)**
>
> Configure your application to capture or ignore request, custom, and JavaScript errors.

So it’s not as simple as entering a value like that:

_After adding or excluding a custom error in Dynatrace, you must trigger the error in your application by using the `dtrum.reportCustomError()` method of the JavaScript API._

That does sound useful though and could be a good idea/RFE to post.
