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

**URL:** <https://community.dynatrace.com/t/custom-errors-and-custom-session-properties-in-an-ionic-app-hybrid/38595>\
**Category:** Open Q&A\
**Tags:** installation, dynatrace-managed, oneagent\
**Created:** [February 24, 2023, 8:28pm UTC](https://community.dynatrace.com/t/custom-errors-and-custom-session-properties-in-an-ionic-app-hybrid/38595 "2023-02-24T20:28:12Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![gus\_solji](https://avatars.discourse-cdn.com/v4/letter/g/90db22/32.png) [@gus\_solji](https://community.dynatrace.com/u/gus_solji)\
**Post date:** [February 24, 2023, 8:28pm UTC](https://community.dynatrace.com/t/custom-errors-and-custom-session-properties-in-an-ionic-app-hybrid/38595/1 "2023-02-24T20:28:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![DanielS](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@DanielS](https://community.dynatrace.com/u/DanielS)\
**Post date:** [February 24, 2023, 8:37pm UTC](https://community.dynatrace.com/t/custom-errors-and-custom-session-properties-in-an-ionic-app-hybrid/38595/2 "2023-02-24T20:37:02Z")

</div>

Hi [@gus\_solji](https://community.dynatrace.com/user/60054),&nbsp;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.

---

<div class="post-metadata">

**Author:** ![gus\_solji](https://avatars.discourse-cdn.com/v4/letter/g/90db22/32.png) [@gus\_solji](https://community.dynatrace.com/u/gus_solji)\
**Post date:** [February 24, 2023, 8:54pm UTC](https://community.dynatrace.com/t/custom-errors-and-custom-session-properties-in-an-ionic-app-hybrid/38595/3 "2023-02-24T20:54:17Z")

</div>

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](https://global.discourse-cdn.com/dynatrace/original/2X/b/b4d6aa404dba81099fbb18ec3bcd01aae887268d.png)

---

<div class="post-metadata">

**Author:** ![DanielS](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@DanielS](https://community.dynatrace.com/u/DanielS)\
**Post date:** [February 24, 2023, 9:46pm UTC](https://community.dynatrace.com/t/custom-errors-and-custom-session-properties-in-an-ionic-app-hybrid/38595/4 "2023-02-24T21:46:08Z")

</div>

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-F242E9E09FD86381?Api-Token=KpklasfdEOev3OAUbzc7P](https://www.com.com:9999/e/esdeds-1059-4728-8d5e-f30819dbc4cc/api/v1/rum/jsInlineScript/APPLICATION-F242E9E09FD86381?Api-Token=KpklasfdEOev3OAUbzc7P)”,  
},

---

<div class="post-metadata">

**Author:** ![gus\_solji](https://avatars.discourse-cdn.com/v4/letter/g/90db22/32.png) [@gus\_solji](https://community.dynatrace.com/u/gus_solji)\
**Post date:** [February 24, 2023, 10:08pm UTC](https://community.dynatrace.com/t/custom-errors-and-custom-session-properties-in-an-ionic-app-hybrid/38595/5 "2023-02-24T22:08:39Z")

</div>

Thanks again for your help Daniel,

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

js : {&nbsp; &nbsp; &nbsp; &nbsp; url : “[https://dynatrace.com/api/v1/rum/jsInlineScript/APPLICATION-example?Api-Token=example](https://dynatrace.com/api/v1/rum/jsInlineScript/APPLICATION-example?Api-Token=example)”,&nbsp; &nbsp; &nbsp; &nbsp; mode:2&nbsp; &nbsp; },

---

<div class="post-metadata">

**Author:** ![DanielS](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@DanielS](https://community.dynatrace.com/u/DanielS)\
**Post date:** [February 27, 2023, 4:34pm UTC](https://community.dynatrace.com/t/custom-errors-and-custom-session-properties-in-an-ionic-app-hybrid/38595/6 "2023-02-27T16:34:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gus\_solji](https://avatars.discourse-cdn.com/v4/letter/g/90db22/32.png) [@gus\_solji](https://community.dynatrace.com/u/gus_solji)\
**Post date:** [February 27, 2023, 6:01pm UTC](https://community.dynatrace.com/t/custom-errors-and-custom-session-properties-in-an-ionic-app-hybrid/38595/7 "2023-02-27T18:01:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gus\_solji](https://avatars.discourse-cdn.com/v4/letter/g/90db22/32.png) [@gus\_solji](https://community.dynatrace.com/u/gus_solji)\
**Post date:** [February 27, 2023, 6:07pm UTC](https://community.dynatrace.com/t/custom-errors-and-custom-session-properties-in-an-ionic-app-hybrid/38595/8 "2023-02-27T18:07:54Z")

</div>

Hi Daniel,

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

Thanks

---

<div class="post-metadata">

**Author:** ![DanielS](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@DanielS](https://community.dynatrace.com/u/DanielS)\
**Post date:** [February 27, 2023, 6:13pm UTC](https://community.dynatrace.com/t/custom-errors-and-custom-session-properties-in-an-ionic-app-hybrid/38595/9 "2023-02-27T18:13:50Z")

</div>

yes, curl -X GET “[https://dynatrace.com/api/v1/rum/jsInlineScript/APPLICATION-example?Api-Token=example](https://dynatrace.com/api/v1/rum/jsInlineScript/APPLICATION-example?Api-Token=example&_ga=2.51506665.1185575533.1677515192-1128486460.1605038164)” -H “accept: \*/\*” -H “Authorization: Api-Token 123456”

You can change URL and API TOKEN with yours.

---

<div class="post-metadata">

**Author:** ![gus\_solji](https://avatars.discourse-cdn.com/v4/letter/g/90db22/32.png) [@gus\_solji](https://community.dynatrace.com/u/gus_solji)\
**Post date:** [February 27, 2023, 7:36pm UTC](https://community.dynatrace.com/t/custom-errors-and-custom-session-properties-in-an-ionic-app-hybrid/38595/10 "2023-02-27T19:36:59Z")

</div>

thanks, I got this

![gus_solji_0-1677526546968.png](https://global.discourse-cdn.com/dynatrace/original/2X/e/e888f37f33206012d4bb6d304aa515774c70c31d.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

---

<div class="post-metadata">

**Author:** ![DanielS](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@DanielS](https://community.dynatrace.com/u/DanielS)\
**Post date:** [February 27, 2023, 11:32pm UTC](https://community.dynatrace.com/t/custom-errors-and-custom-session-properties-in-an-ionic-app-hybrid/38595/11 "2023-02-27T23:32:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gus\_solji](https://avatars.discourse-cdn.com/v4/letter/g/90db22/32.png) [@gus\_solji](https://community.dynatrace.com/u/gus_solji)\
**Post date:** [February 28, 2023, 5:55pm UTC](https://community.dynatrace.com/t/custom-errors-and-custom-session-properties-in-an-ionic-app-hybrid/38595/12 "2023-02-28T17:55:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![DanielS](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@DanielS](https://community.dynatrace.com/u/DanielS)\
**Post date:** [February 28, 2023, 6:05pm UTC](https://community.dynatrace.com/t/custom-errors-and-custom-session-properties-in-an-ionic-app-hybrid/38595/13 "2023-02-28T18:05:44Z")

</div>

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

 ![DanielS_0-1677607520282.png](https://global.discourse-cdn.com/dynatrace/original/2X/c/ca0051c7fb686d7bb7fb83220ed384a7ace1b87f.png)

---

<div class="post-metadata">

**Author:** ![gus\_solji](https://avatars.discourse-cdn.com/v4/letter/g/90db22/32.png) [@gus\_solji](https://community.dynatrace.com/u/gus_solji)\
**Post date:** [February 28, 2023, 6:19pm UTC](https://community.dynatrace.com/t/custom-errors-and-custom-session-properties-in-an-ionic-app-hybrid/38595/14 "2023-02-28T18:19:40Z")

</div>

Yes the percentage is 100%

 ![gus_solji_0-1677608275757.png](https://global.discourse-cdn.com/dynatrace/original/2X/2/2b3e78be0cd34f0134b80bda98e80f1f2312d633.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.

---

<div class="post-metadata">

**Author:** ![DanielS](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@DanielS](https://community.dynatrace.com/u/DanielS)\
**Post date:** [February 28, 2023, 6:46pm UTC](https://community.dynatrace.com/t/custom-errors-and-custom-session-properties-in-an-ionic-app-hybrid/38595/15 "2023-02-28T18:46:45Z")

</div>

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

 ![DanielS_0-1677609998914.png](https://global.discourse-cdn.com/dynatrace/original/3X/a/f/afc8458f88bc13123de8a72b8c290aa93a5702a5.png)

---

<div class="post-metadata">

**Author:** ![DanielS](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@DanielS](https://community.dynatrace.com/u/DanielS)\
**Post date:** [February 28, 2023, 6:54pm UTC](https://community.dynatrace.com/t/custom-errors-and-custom-session-properties-in-an-ionic-app-hybrid/38595/16 "2023-02-28T18:54:37Z")

</div>

Also, please have a look at [this](https://www.dynatrace.com/support/help/shortlink/beacon-forwarder) my guess is that you have problems with the beacon. Because everything else seems ok. And please check your firewall settings with [this](https://www.dynatrace.com/support/help/shortlink/rum-firewall). Your firewall could be ripping off headers.

Your Dynatrace config seems ok, for me it is an external problem.

---

<div class="post-metadata">

**Author:** ![gus\_solji](https://avatars.discourse-cdn.com/v4/letter/g/90db22/32.png) [@gus\_solji](https://community.dynatrace.com/u/gus_solji)\
**Post date:** [February 28, 2023, 10:05pm UTC](https://community.dynatrace.com/t/custom-errors-and-custom-session-properties-in-an-ionic-app-hybrid/38595/17 "2023-02-28T22:05:03Z")

</div>

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

Thanks for all the help Daniel
