User action names are generated automatically based on triggered load or XHR URLs and are often difficult to read and remember. When your application handles a lot of user requests and interactions per day, tracking user actions becomes difficult when you don't have the means to group them logically.
User action naming rules give you the option to generate consistent and readable user actions that can be easily grouped and tracked throughout the application.
These action naming rules can be created and customized for each application individually and then used throughout Dynatrace in:
add-to-shopping-cart
and newsletter-sign-up
)To easily create and maintain user action naming rules, you can make use of placeholders, input parameters, and even different rules for Load and XHR actions.
Dynatrace tries to assign meaningful names for actions. To do this, it checks several action properties, such as inner HTML, caption, and hint of the HTML element that triggers the action. This element can either be a button or an anchor. It also tries to get the caption if there's a more complex HTML structure with multiple nested tags.
The RUM JavaScript uses several techniques to choose the name that best fits an action. It starts with the innermost HTML node that is clicked, such as a button, an image tag, or a link, and checks the following in the order of precedence:
data-dtname
attributenodeName
, such as an image, anchor, or inputhtml
tag, body
tag, head
tag, or document
element is found.innerText
or textContent
If none of these return a reasonable result, the RUM JavaScript starts applying a recursive algorithm that checks different things depending on nodeName
of the currently checked HTML node. If nothing is found, the parent node is checked.
Placeholders allow you to add dynamic elements to custom naming rules.
Placeholders are useful in cases where you want to have dynamic input values (for example, the URLs of blog posts visited by your users) included in user action names or when you want to remove or replace certain parts of an input value (for example, dynamic user session IDs) and group them under a common user action name.
Placeholders consist of the following three elements:
To make placeholders easier to use, Dynatrace provides a set of pre-defined placeholders, such as pageUrl
, sourceUrl
, xhrUrl
, Top XHR URL
, and pageTitle
. To understand placeholders better, consider the following example: an XHR action triggers the selection of the confirmation button on a checkout page. Selecting the confirmation button (the source action in this case) is followed by one of these target actions:
xhrUrl
or Top XHR URL
.sourceUrl
, which is the URL where you finished the checkout process, and the pageUrl
, which is the URL where you see the confirmation of the checkout process.Such chains and correlations of actions are best seen in a waterfall chart. You can use sourceURL
and pageURL
, or the XHR equivalents XHRUrl
and Top XHR URL
, to properly name your actions in cases where such correlations occur.
The provided set of placeholders is non-customizable but can be immediately used for creating your own naming rules. You can also create your own placeholders.
To create a placeholder
Go to Web.
Select the application that you want to configure.
In the upper-right corner of the application overview page, select More (…) > Edit.
From the application settings, select Capturing > User actions.
Under Placeholders, select Add placeholder, and select your input data type.
For the CSS selector, JavaScript variable, Meta tag, and Cookie value data types, you must also specify a value.
optional Add processing steps and conditions, and preview your placeholder to see if it works as intended.
optional In case you added an extract or extract with regular expression processing step, select whether you want to fall back to an empty result (default) or the selected input.
Name your placeholder, and select Save.
You can add up to 50 placeholders per application.
To help you make the most of placeholders, we’ve introduced the following processing steps:
(.*)
capture group is supported.If you add multiple processing steps to a placeholder, the steps will be applied in sequence. This means that the first processing step will be applied on the selected input and each subsequent processing step will be applied on the result of the previous processing step.
Dynatrace provides you with the option of creating custom load as well as XHR actions. You can use new placeholders or the existing placeholders that are available in the Placeholders list to create your new naming rules.
In this example, we use CampaignID
to create a new custom naming rule that identifies a page load as a campaign view with the CampaignID
added to the action name.
Go to Web.
Select the application that you want to configure.
In the upper-right corner of the application overview page, select More (…) > Edit.
From the application settings, select Capturing > User actions.
Scroll down to User action naming rules, and select the Naming rules for load actions or Naming rules for XHR actions tab.
Select Add naming rule.
Type a naming pattern using a placeholder. Ensure that the placeholder is within braces (example: {CampaignID}
).
optional Define the conditions under which you can also use placeholders to further refine the applicability of the rules.
In our example, to create a custom action naming rule that only applies to a special promotional campaign, where CampaignID
is 3, you can use conditions and placeholders to only match the desired actions that should be named accordingly.
optional Use the Preview your rule section to check if your new naming rule works as expected.
Select Save.
Use the Move up/down controls to change the priority of the rules.
The first matching rule in the table is applied first.
You can add up to 250 user action naming rules per application.
The following additional configuration options are available for user action names:
www.domain-one.com
and www.domain-two.com
, and splitting by domain is enabled, a load of page /index
for www.domain-one.com
will result in a different user action than load of page /index
for www.domain-two.com
.Loading of Page /
and Loading of PAGE /
will both map to loading of page /
.pageUrl
, of your last load action values for your user action naming. As an example, consider an initial user action like click /easytravel/search
, which triggers a page reload from the /easytravel
page to the /easytravel/search
page and therefore the loading of page /easytravel/search
load action, which in turn triggers another XHR call.
loading of page /easytravel/search
load action.click /easytravel/search
, since with the previous version of our load propagation, the load action is not propagated in scenarios where XHR requests are present as well.In the following sections, we look at examples of user action naming rules that were created in the earlier version and show how equivalent rules can be created using the new, enhanced version of user action naming rules.
Examples from the earlier version of user action naming rules:
/some-path-before/(.*).some-defined-text-after from path
from pathLoading of page /sales/(.*)
from action name(.*)
from page title(.*)
from XHR URLYou can now achieve the same result using placeholders and a processing step.
With the extract processing step, you can define leading and trailing delimiters that define exactly where extracted values are to be pulled from. In this way, it’s possible to replace many naming rules that previously required regular expressions.
Examples from the earlier version of user action naming:
design
*/config/*
/product/
/api/search/dynamic
In the earlier version of user action naming rules, the action name was typically used as an input value for the renaming of action names that were automatically detected by Dynatrace. This often led to confusion, since users didn’t understand that action names were being used as input values as they were defined.
What had to be differentiated here is the auto-detected action name by Dynatrace (a possible input) and the final action name defined by the user through the naming rule. In all these cases, a user could have simply used the page path or URL or the XHR URL instead.
With the new version, you can use a default placeholder in your naming rule, such as pageUrlPath
or pageUrl
, to get the same information, followed by the begins with or contains condition to do the same.
Conversely, you can use a match regular expression condition for more flexibility.
For example, former rules in the earlier version of user action naming:
Customer Contact Request for UFO
: XHR url matches regex match .*/api/request/.*/contact?category=UFO
Examples from the earlier version of user action naming:
(\\?|&)_id=:*?(?=&|$)
(\\?|&)conversation=:*?(?=&|$)
\?.*
(?<=search-results\/cars\/)[a-zA-Z0-9]*
Removing and masking parts of data can now be achieved more easily with the "remove in-between" approach. If you want to remove the value of a certain query string parameter, which could be the ID of your user, define the key as a trailing delimiter and &
as a following character that introduces other parameters. If your matching input doesn’t have a trailing delimiter, you'll be notified.
For more flexibility or, for example, to remove all parameters of your URL, use replace by regular expression.
Let’s consider an e-commerce checkout in this example. To name your load actions for each step in the earlier version, you had to first define one action naming rule for each individual step.
In this case, one rule is assigned per checkout step:
/checkout/index.php?step=details
/checkout/index.php?step=payment
/checkout/index.php?step=summary
/checkout/index.php?step=confirmation
With the new version, you can create a placeholder that uses a JavaScript variable called adobePageName
as input, which may already be available in an existing data layer of an analytics tool, for example Adobe Analytics.
Leveraging the power of your previously defined placeholder, you can then create a single action naming rule that covers all the naming rules you created with the earlier version and result in the same action names.
data-dtname
If the standard action name detection doesn't serve your purpose, you can also set the data-dtname
custom attribute within the HTML tags and use it as a caption. For instance, the following action:
<label for="txtFirstname">Firstname</label> <input data-dtname="Firstname Text Input" type="text" value="firstname" name="firstname" title="Firstname" id="txtFirstname" />
can be assigned the click on "Firstname Text Input"
caption.
For a custom attribute to appear as a user action name, you also need to configure a naming rule that includes the {elementIdentifier (default)}
placeholder.
If you're using different attribute names for different tools, you can choose to set an alternative to data-dtname
that Dynatrace can use for user action naming purposes.