on 21 Mar 2024 08:00 AM
If you notice your sessions aren't correctly tagged or if you have missing metadata, it's likely due to the application data privacy setting called Do Not Track.
For this setting, the Capture anonymous user-session data for "Do Not Track" enabled browsers option is enabled by default, which is an important element of RUM data privacy. This option ensures that Dynatrace only captures anonymized sessions when the "Do Not Track" setting is detected in users' browsers.
You can change the Do Not Track setting for your application. Note that if you select the Disable Real User Monitoring for "Do Not Track" enabled browsers option, RUM is turned off when the "Do Not Track" setting is detected in users' browsers.
For detailed instructions, see Configure data privacy settings for web applications | Do Not Track.
Check the following if some required metadata is missing for your web applications. Also, check Web applications: Sessions are randomly split into shorter sessions.
Check whether RUM JavaScript can capture value right now
The RUM JavaScript offers the dtrum.getAndEvaluateMetaData()
function that captures all the configured metadata and lists the current values. If the metadata was not captured, then the function lists a reason for that.
If the metadata expression is not listed, the page you are currently on might not be mapping to the correct application.
If the metadata expression shows the data you intended to capture, the data might not be available when the RUM JavaScript is capturing it. The data is captured whenever an action is finished, so if the data is only available afterwards, then the RUM JavaScript cannot capture these values.
IFrames and Frames have their own JavaScript context, so it's impossible to access variables that are only available in another frame. DOM elements must also be available in a Frame or IFrame in which the RUM JavaScript is injected because IFrames can have access restrictions.
You can use Chrome DevTools to verify JavaScript variable or DOM element capture. To do this, perform the desired action in the application. Then go to the Console tab in Chrome DevTools, and then check the log for DOM Element value
and Variable value
entries. Ensure that those entries have valid values.
The following image shows a DOM Element access in the IFrame that contains the DOM Element.
This image shows a DOM Element access in the IFrame that doesn't contain the DOM Element.
Perform the following actions to verify that the DOM selector is correct:
Make sure document.querySelector
is available by typing it into the Chrome DevTools console. If it's not available, you won't be able to capture values in this browser. However, this is unlikely as document.querySelector
is supported even by older browser versions.
Make sure document.querySelector('yourselector')
returns the value you want to capture. If not, then your queryselector
is incorrect and the RUM JavaScript is not reporting data. See W3C Selectors API for more information about queryselector
.
To check the return value for document.querySelector
, perform the desired action in the application. Then in Chrome DevTools, go to the Elements tab, do a string search for document.querySelector
, and verify the return value.
The following image shows data correctly returned from document.querySelector
:
If the cookies have the HttpOnly
flag set, the RUM JavaScript can't access its values and the value isn't reported, as shown in the following image.
You can check if the HttpOnly
flag is set for cookies in the Application tab of Chrome DevTools.
Sometimes cookies aren't set on the correct domain, even though they appear in Chrome DevTools. This means that you can see the cookie value in Chrome DevTools, but the cookie isn't accessible from the RUM JavaScript.
To try this, you can search the document.cookie
string in the Chrome DevTools console and check if the return string contains the cookie you want to capture.