# window.dtrum is always undefined using dtrum.d.ts

**URL:** <https://community.dynatrace.com/t/window-dtrum-is-always-undefined-using-dtrum-d-ts/42782>\
**Category:** Real User Monitoring\
**Tags:** user-actions, javascript\
**Created:** [November 22, 2023, 4:57pm UTC](https://community.dynatrace.com/t/window-dtrum-is-always-undefined-using-dtrum-d-ts/42782 "2023-11-22T16:57:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![christiansolano](https://avatars.discourse-cdn.com/v4/letter/c/bb73d2/32.png) [@christiansolano](https://community.dynatrace.com/u/christiansolano)\
**Post date:** [November 22, 2023, 4:57pm UTC](https://community.dynatrace.com/t/window-dtrum-is-always-undefined-using-dtrum-d-ts/42782/1 "2023-11-22T16:57:31Z")

</div>

Hi,

I trying to use the dtrum API. However, it is not working even after configuring the Dynatrace folder on the typeRoots section under the compilerOptions of the tsconfig.json.

Any idea how to solve this issue?

---

<div class="post-metadata">

**Author:** ![Matthias\_1](https://avatars.discourse-cdn.com/v4/letter/m/bc79bd/32.png) [@Matthias\_1](https://community.dynatrace.com/u/Matthias_1)\
**Post date:** [August 8, 2024, 7:23am UTC](https://community.dynatrace.com/t/window-dtrum-is-always-undefined-using-dtrum-d-ts/42782/2 "2024-08-08T07:23:48Z")

</div>

Hi,

Firstly, it’s important to note that the&nbsp;dtrum.d.ts&nbsp;file is only a types file and does not contain any actual logic. This means that simply configuring the Dynatrace folder in the&nbsp;typeRoots&nbsp;section under&nbsp;compilerOptions&nbsp;of your&nbsp;tsconfig.json&nbsp;won’t make the API work on its own.

To ensure the dtrum API functions correctly, you should validate that the RUM JavaScript snippet is running properly in your environment. This is crucial as this snippet is responsible for the actual implementation of the dtrum API.

Additionally, for a robust implementation, it’s a good practice to treat the dtrum API as optional in your JavaScript code. This way, your application can gracefully handle scenarios where the API might not be available.

More related documentation:&nbsp;[Customize Real User Monitoring Classic with the JavaScript API for web applications — Dynatrace Docs](https://docs.dynatrace.com/docs/platform-modules/digital-experience/web-applications/additional-configuration/customize-rum)

I hope this helps!
