# Web applications: Sessions are not correctly tagged or metadata is missing

**URL:** <https://community.dynatrace.com/t/web-applications-sessions-are-not-correctly-tagged-or-metadata-is-missing/44530>\
**Category:** Troubleshooting\
**Tags:** real-user-monitoring-classic, web-monitoring\
**Created:** [March 21, 2024, 8:00am UTC](https://community.dynatrace.com/t/web-applications-sessions-are-not-correctly-tagged-or-metadata-is-missing/44530 "2024-03-21T08:00:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![maliborskaya](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@maliborskaya](https://community.dynatrace.com/u/maliborskaya)\
**Post date:** [March 21, 2024, 8:00am UTC](https://community.dynatrace.com/t/web-applications-sessions-are-not-correctly-tagged-or-metadata-is-missing/44530/1 "2024-03-21T08:00:00Z")

</div>

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&nbsp; **Do Not Track**.

For this setting, the&nbsp; **Capture anonymous user-session data for “Do Not Track” enabled browsers** &nbsp;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&nbsp; **Do Not Track** &nbsp;setting for your application. Note that if you select the&nbsp; **Disable Real User Monitoring for “Do Not Track” enabled browsers** &nbsp;option, RUM is turned off when the “Do Not Track” setting is detected in users’ browsers.

For detailed instructions, see&nbsp;[Configure data privacy settings for web applications | Do Not Track](https://docs.dynatrace.com/docs/shortlink/configure-rum-privacy#do-not-track-gdpr).

Check the following if some required metadata is missing for your [web applications](https://docs.dynatrace.com/docs/shortlink/web-applications-landing). Also, check&nbsp;[Web applications: Sessions are randomly split into shorter sessions](https://community.dynatrace.com/topic/239479).

Check whether RUM JavaScript can capture value right now

The RUM JavaScript offers the&nbsp;`dtrum.getAndEvaluateMetaData()`&nbsp;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.

## Check if JS variable or DOM element is contained in Frame/IFrame

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&nbsp; **Console** &nbsp;tab in Chrome DevTools, and then check the log for&nbsp;`DOM Element value`&nbsp;and&nbsp;`Variable value`&nbsp;entries. Ensure that those entries have valid values.

The following image shows a DOM Element access in the IFrame that contains the DOM Element.

 ![rum-troubleshooting-cors-iframe2-1450-d5047b1014](https://global.discourse-cdn.com/dynatrace/original/2X/4/4887beada2ccb417d25a13920fe0210fd6db09b0.png)

This image shows a DOM Element access in the IFrame that doesn’t contain the DOM Element.

 ![rum-troubleshooting-cors-iframe1-1449-1898b03c80](https://global.discourse-cdn.com/dynatrace/original/3X/e/8/e80c75e6d3b0ca646e23a069360615f4a6c1cee6.png)

## Check if DOM selector is wrong or querySelector isn’t available

Perform the following actions to verify that the DOM selector is correct:

- Make sure&nbsp;`document.querySelector`&nbsp;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&nbsp;`document.querySelector`&nbsp;is supported even by older browser versions.
- Make sure&nbsp;`document.querySelector('yourselector')`&nbsp;returns the value you want to capture. If not, then your&nbsp;`queryselector`&nbsp;is incorrect and the RUM JavaScript is not reporting data. See&nbsp;[W3C Selectors API](https://www.w3.org/TR/selectors-api/)&nbsp;for more information about&nbsp;`queryselector`.

To check the return value for&nbsp;`document.querySelector`, perform the desired action in the application. Then in Chrome DevTools, go to the&nbsp; **Elements** &nbsp;tab, do a string search for&nbsp;`document.querySelector`, and verify the return value.

The following image shows data correctly returned from&nbsp;`document.querySelector`:

 ![rum-troubleshooting-cors-queryselector1-1458-58172f7419](https://global.discourse-cdn.com/dynatrace/original/3X/8/6/86f5f33d791c5484bf16156110000de7d525cda5.png)

## Check if cookies are using HttpOnly

If the cookies have the&nbsp;`HttpOnly`&nbsp;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&nbsp;`HttpOnly`&nbsp;flag is set for cookies in the&nbsp; **Application** &nbsp;tab of Chrome DevTools.

 ![rum-troubleshooting-cors-cookiehttponly-1448-a8555bf2fe](https://global.discourse-cdn.com/dynatrace/original/2X/b/b9ff4d04b9380a2ec256bfbc34fd1f6847ad78c0.png)

## **Ensure cookies are set on correct domain**

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&nbsp;`document.cookie`&nbsp;string in the Chrome DevTools console and check if the return string contains the cookie you want to capture.

 ![rum-troubleshooting-cors-cookiedomainpng-1782-dbc8d3f33b](https://global.discourse-cdn.com/dynatrace/original/2X/1/107eee24e105acee9046ac3eb14cfac1f00a9b22.png)
