Hello everyone!
Context
Dynatrace is set up within the company and applications have been created, which are successfully receiving RUM traffic. However, some applications that are manually injected have been created through the creation of detection rules, meaning they are presented as auto injected by Dynatrace.
Problem statement
I need to accurately determine whether each application has been injected manually or automatically, along with identifying the specific injection format (OneAgent JS Tag, JS Tag, Inline code, or code snippet).
This will help me, among other things, determine which manually injected applications were created through detection rules and, hence, should be re-created as agentless.
Methodology
To ascertain the type and format of an injection, I utilize the following function in the Developer Tools console of the web page associated with the application: dT_.gdi() (Source). The output provides various details, for instance:
In my exploration of this function, I have identified a few key points:
Conflict with Dynatrace documentation
According to the documentation, “For automatic injection, different injection formats of the RUM JavaScript look different, but what they all have in common is the data-dtconfig attribute.” (source: Rum JavaScript injection).
However, this contradicts my findings with dT_.gdi(), as the automatically injected CodeSnippetDeferred and CodeSnippetSync scripts do not contain this attribute, yet dT_.gdi() recognizes them correctly.
My conclusion on this part is that the documentation is wrong.
Wrongly determined format
dT_.gdi() will determine a web application with a CodeSnippetDeferred injection as a CodeSnippetSync injection. From my testings, dT._gdi() seems to be looking for the defer keyword, which is not present in the CodeSnippetDeferred. Indeed, the only difference between both code snippets is the presence of the keyword async in the CodeSnippetDefered.
My conclusion on this part is that dT_.gdi() is wrong.
Questions
Given this, my questions are the following:
- How trustable is dT_.gdi()? Is it deprecated?
- How do I accurately determine the injection format and type? For now, I am relying on the dT_.gdi() function while inspecting more deeply the injected element in the HTML when I encounter use cases where dT_.gdi() might be wrong. However, I have the impression that there should be a more straightforward solution to this.
Thank you in advance for your feedback .
