- Go to Settings > Web and mobile monitoring > Advanced setup.
- Click Download documentation and samples. A sample HTML file called
User tagging based on page source
For example, easyTravel, the Dynatrace demo application, includes the user name in a welcome message in the upper-right corner of the home page (see image below). Using the development tools that are built into most browsers, you can generate a unique CSS selector for this particular element.
Once you’ve identified where usernames are located in your page source, you can create user tags based on the usernames:
- From the navigation menu, click Applications.
- Select the application you want to configure.
- Click the Browse (…) button and select Edit.
- Select Capturing and click User tags.
- Click Add tag (identifier) rule.
- From the Expression type to capture drop list, select CSS selector. Note, in this example, the user's identifier is extracted from the page source using the CSS selector. See Available page data sources to learn about other data sources.
- Type the CSS selector value into the CSS selector field.
- optional To ensure that there is a clean extraction of the username value, you can apply a regex cleanup rule by enabling the Enable cleanup rule switch and then typing a regular expression in the Regex field.
- Click Add tag (identifier) rule and then click Save.
Note: You can add a maximum of 20 user tag (identifier) rules per application.
md= is now listed in this page’s metadata expressions.
Once you’ve completed this process, select User sessions from the navigation menu. Click in the filter text box at the top of the page. Choose the User tag attribute and select a user tag from the list. The chart now shows detailed session data related to the sessions of this specific user. You can click the name of the user that appears under the chart to navigate to this user’s overview page and view further details.
Available page data sources
The Expression type to capture list provides you with the following data sources from which you can extract the user's identifier:
- CSS selector: use when the user's identifier is visible on your page. This mechanism will capture the first match's
innerText/textContentvalue (available for browsers that support
querySelector). To retrieve a specific attribute value of the element, append the '@' symbol, followed by the attribute name (i.e., '#someDomElement@someAttribute').
- Meta tag: use when your user's identifier is present in one of the meta tags in the source of your page. This specifies the meta tag name that Dynatrace will use to capture its 'content' value.
- Cookie value use when your user's identifier is present in one of your existing cookies.
- Query string: use when your user's identifier is part of a certain query string parameter, which you can define here.
- Server side request attribute: use when you want to use a server-side request attributes to tag each user session. Once you've defined a request attribute, all you need to do is to use it at step 6. Note that the service request attribute may not be captured for every user action/user session, as your server-side PurePath may be not captured due to adaptive capture control.
What if user tracking isn’t allowed at my company?
If your organization doesn’t allow tracking of individual users for privacy reasons, you can alternatively define user tags that correspond to team names or department names. In this way, you can monitor the experience of individual users while not disclosing any identifying information.
Additional notes and limits
- All captured values are cropped to a maximum length of 100 characters.
- The last user action in a session that contains a tag will be used as the tag for the entire session.
- You can also identify mobile users of native mobile apps.