11 Apr 2023 03:22 PM - edited 12 Apr 2023 04:11 AM
In some cases, we are going to need to use the JavaScript Agent interface for our instrumentation e.g. user tagging (dtrum.identifyUser), create custom action, etc. The interface will be provided by the JavaScript Agent, it can be used everywhere in your application by simply calling dtrum.
However, due to some factors then the interface might not be available and will cause some issues during instrumentation. You may face errors like "dtrum is undefined".
Here are some sanity checks we can perform to figure out why dtrum is not available:
1. We need to check if there are no errors in the build logs. You can refer to these instructions on how to get the logs. You need to check for errors pertaining to the javascript url. See screenshot for an example:
If you see an error similar to this then we need to make sure that our configuration (dynatrace.config.js) is correct. Specifically, we need make sure that the js url is valid/correct and has a valid access tokens.
2. Even if we ruled out number 1, we can still face issues when running the application. So we need to make sure that the javascript agent (ruxitagentjs) is actually inserted in the the web application (html page). In this step, we need to check the HAR file from the webviews. You can follow the instructions to check the webview.
- check the elements tab and see if the script is inserted to the html page:
- check if the js agent code is downloaded successfully by going to the networks tabs. The response should be http 200 (OK).
If the js agent is not downloaded successfully then you need to check for any environmental factors that may affect this. In most cases, there might be some middle layers that are affecting this. See this documentation https://www.dynatrace.com/support/help/shortlink/rum-firewall
In some cases, if your machine or network does not allow download of the js agent. Then you can add the snippet locally into your machine. https://community.dynatrace.com/t5/Troubleshooting/Download-the-javascript-agent-locally-and-build-t...
What to do next?
After all the checks and we still see the same problem then you can provide the build logs (from #1) and the HAR file (from #2) to the support ticket (create a new ticket if none yet).