Dynatrace tracks real user metrics on our websites using DEM and this is done through an agentless script injection.
They are not able to track the Genesys Messenger that we installed on the websites, because Genesys pure cloud domain is outside our company domain. In order to do that Dynatrace team will create a script and asking us to consult with Genesys for injection, but Genesys customer care responded saying they don't do that and pointed us to the Developer Forum. Could someone help us if you've come across this scenario and how did you solve for it?
I have never done this with Dynatrace, but have with Google Analytics. You can subscribe for Launcher, Messenger and Conversation events listed here https://developer.genesys.cloud/commdigital/digital/webmessaging/messengersdk/SDKCommandsEvents/ and use a javascript callback function (maybe the one you described above) to send these events to the tracker. An example for calling the gtag function of Google is: