go-acoustic / UICaptureSDK-Modules

Optional modules which extend the Acoustic Tealeaf UI Capture SDK functionality.
3 stars 0 forks source link

Problem if Dynatrace Javascript is Running #11

Closed quackdor closed 2 years ago

quackdor commented 3 years ago

If the Dynatrace Javascript library is running in an application, the Tealeaf Ajax Listener isn't able to record any ajax calls. Tested multiple times. It doesn't prevent the Tealeaf POSTs from being received but is apparently preventing visibility from other Javascript.

Using 1.2.2,

mpunjabi-aco commented 3 years ago

In v1.2.2, the AjaxListener module checks to see if XMLHttpRequest and fetch is a native implementation. If a 3rd party script/polyfill is already overriding the native implementation then the AjaxListener module will not intercept these APIs. This is intentionally done in order to minimize any risk of faulty 3rd party implementations causing errors.

You can test this by removing the check which occurs on line 558-562 for XMLHttpRequest and line 566-568 for fetch

A better alternative is to load the UIC script first, such that the AjaxListener will interact with the native implementations.

Reference: https://github.com/acoustic-analytics/UICaptureSDK-Modules/tree/master/AjaxListener#warning-important-note

quackdor commented 3 years ago

Unfortunately, the Dynatrace Oneagent forces its Javascript injection as the first Script on the page so we can't do anything about it.

quackdor commented 3 years ago

Based on your comment about removing the checks for native XHR and fetch would you say that the risk is minimal if non-existent if the 3rd party script is for sure not faulty?

mpunjabi-aco commented 3 years ago

would you say that the risk is minimal if non-existent if the 3rd party script is for sure not faulty?

The risk cannot be non-existent but it can certainly be minimized by adequate testing and monitoring.

mpunjabi-aco commented 2 years ago

Added a configuration flag to bypass the safety check in module version 1.3.0