cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Custom errors and custom session properties in an ionic app (hybrid)

gus_solji
Participant

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

16 REPLIES 16

DanielS
DynaMight Guru
DynaMight Guru

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.

The true delight is in the finding out rather than in the knowing.

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 

gus_solji_0-1677272046763.png

 

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-...",
},

The true delight is in the finding out rather than in the knowing.

Thanks again for your help Daniel,

I checked the file and yes I have this configuration.:

great, so can you try using a curl if you have connectivity to that url?

The true delight is in the finding out rather than in the knowing.

Hi Daniel,

Could you give me an example of curl to be able to do it?

Thanks

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.

The true delight is in the finding out rather than in the knowing.

thanks, I got this

gus_solji_0-1677526546968.png

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

my mistake, sorry, I edited the curl I send you one more pair of "

The true delight is in the finding out rather than in the knowing.

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

your welcome, just to be sure, the percentage of sessions is at 100%?

 

DanielS_0-1677607520282.png

 

The true delight is in the finding out rather than in the knowing.

Yes the percentage is 100%

gus_solji_0-1677608275757.png

 

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.

and for custom errors the config is Any key and value?

 

DanielS_0-1677609998914.png

 

The true delight is in the finding out rather than in the knowing.

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.

The true delight is in the finding out rather than in the knowing.

The cors is not enabled for my mobile app. It is working now.

Thanks for all the help Daniel

gus_solji
Participant

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

Featured Posts