24 Feb 2023 08:28 PM
Hi, I want to send properties for the user session and send custom errors from my Ionic mobile application. I installed the @dynatrace/cordova-plugin but when implementing dtrum it tells me that it is not defined. That's why I can't use the dtrum.identifyUser() or the dtrum.reportCustomError(). Any suggestions for this?
Thanks
Solved! Go to Solution.
24 Feb 2023 08:37 PM
Hi @gus_solji, please don't forget this step:
Select Download dynatrace.config.js, and add the downloaded file to the root of your Cordova app workspace next to the config.xml file.
24 Feb 2023 08:54 PM
Hi Daniel, thanks for the answer.
I have the dynatrace.config.js file in the root. My ionic app is with capacitor. Is something different needed to use dtrum?
When I run the app I get this error
24 Feb 2023 09:46 PM
The error means that dtrum is not available for some reason. If you have the .js file installed can you check if you have connectivity to the url listed there.
example:
js : {
url : "https://www.com.com:9999/e/esdeds-1059-4728-8d5e-f30819dbc4cc/api/v1/rum/jsInlineScript/APPLICATION-...",
},
24 Feb 2023 10:08 PM
Thanks again for your help Daniel,
I checked the file and yes I have this configuration.:
27 Feb 2023 04:34 PM
great, so can you try using a curl if you have connectivity to that url?
27 Feb 2023 06:07 PM
Hi Daniel,
Could you give me an example of curl to be able to do it?
Thanks
27 Feb 2023 06:13 PM - edited 27 Feb 2023 11:31 PM
yes, curl -X GET "https://dynatrace.com/api/v1/rum/jsInlineScript/APPLICATION-example?Api-Token=example" -H "accept: */*" -H "Authorization: Api-Token 123456"
You can change URL and API TOKEN with yours.
27 Feb 2023 07:36 PM
thanks, I got this
I'm sure I have some error writing the curl but I don't know which one. When I write the url in the browser I get back the js script
27 Feb 2023 11:32 PM
my mistake, sorry, I edited the curl I send you one more pair of "
28 Feb 2023 05:55 PM
Thanks Daniel now dtrum is working at least now is define in the app but I don't see the information in the dynatrace application. I used this function dtrum.identifyUser("email) and dtrum.reportCustomError("home", "Errro in home") but I don't see the information in the dynatrace application. Any idea?
thanks
28 Feb 2023 06:05 PM
your welcome, just to be sure, the percentage of sessions is at 100%?
28 Feb 2023 06:19 PM
Yes the percentage is 100%
I know I am sending information because dtrum is already defined and I am using console log to be able to see certain responses such as dtrum.sendSessionProperties(). But I can't see the information in dynatrace.
28 Feb 2023 06:46 PM
and for custom errors the config is Any key and value?
28 Feb 2023 06:54 PM
Also, please have a look at this my guess is that you have problems with the beacon. Because everything else seems ok. And please check your firewall settings with this. Your firewall could be ripping off headers.
Your Dynatrace config seems ok, for me it is an external problem.
28 Feb 2023 10:05 PM
The cors is not enabled for my mobile app. It is working now.
Thanks for all the help Daniel
27 Feb 2023 06:01 PM
Hi, I need to send custom errors and identify the user session in a mobile application with ionic and capacitor. To use Dtrum just add the dynatrace.config.js file in the root of the project?
root of the project? and install @dynatrace/cordova-plugin?
Or do I need to do some extra step?
thanks