# Custom transaction names with RUM

**URL:** <https://discuss.elastic.co/t/custom-transaction-names-with-rum/195574>\
**Category:** APM\
**Tags:** rum\
**Created:** [August 16, 2019, 10:35pm UTC](https://discuss.elastic.co/t/custom-transaction-names-with-rum/195574 "2019-08-16T22:35:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![elastichooch](https://avatars.discourse-cdn.com/v4/letter/e/a6a055/32.png) [@elastichooch](https://discuss.elastic.co/u/elastichooch)\
**Post date:** [August 16, 2019, 10:35pm UTC](https://discuss.elastic.co/t/custom-transaction-names-with-rum/195574/1 "2019-08-16T22:35:59Z")

</div>

If you are asking about a problem you are experiencing, please use the following template, as it will help us help you. If you have a different problem, please delete all of this text 🙂

**Kibana version** :  
7.2

**Elasticsearch version** :  
7.2

**APM Server version** :  
7.1

**APM Agent language and version** :  
RUM 4.2

**Is there anything special in your setup?** For example, are you using the Logstash or Kafka outputs? Are you using a load balancer in front of the APM Servers? Have you changed index pattern, generated custom templates, changed agent configuration etc.

**Description of the problem including expected versus actual behavior. Please include screenshots (if relevant)**:  
I have an angular based UI and am using typescript. I called init on apm and got some traces to show up in Kibana. I wanted to have my transactions have names other than Unknown so I tried to follow [https://www.elastic.co/guide/en/apm/agent/js-base/current/custom-transaction-name.html](https://www.elastic.co/guide/en/apm/agent/js-base/current/custom-transaction-name.html). I tried it by adding the pathname split and setting the pageLoadTransactionName to the pageName. I tried setting the pageLoadTransactionName as part of the config that is passed to init. The first page to load has a transaction name of '/'. All subsequent transaction names are "Unknown".

How can I have the transaction names be set to a piece of the url path?

**Errors in browser console (if relevant)**:  
none

**Provide logs and/or server output (if relevant)**:  
n/a

---

<div class="post-metadata">

**Author:** ![vigneshshanmugam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vigneshshanmugam/32/40324_2.png) [@vigneshshanmugam](https://discuss.elastic.co/u/vigneshshanmugam)\
**Post date:** [August 21, 2019, 9:56am UTC](https://discuss.elastic.co/t/custom-transaction-names-with-rum/195574/2 "2019-08-21T09:56:36Z")

</div>

Hi,

Apologies for the delay in responding. The config `pageLoadTransactionName` only works for the first transaction which is of type `page-load` and does not work for subsequent transactions since they belong to type `route-change`.

What you can do right now is to use out Events API (undocumented right now - [https://github.com/elastic/apm-agent-rum-js/issues/389](https://github.com/elastic/apm-agent-rum-js/issues/389)), You can listen for these events and change the transaction names based on location path.

```auto
apm.observe('transaction:end', (tr) => {
  if (tr.name === 'Unknown') {
    tr.name = window.location.pathname
  }
})

```

We are also working on Angular Integration which would make it easier to see the transaction names setting properly to the route names. You can track it here [https://github.com/elastic/apm-agent-rum-js/pull/384](https://github.com/elastic/apm-agent-rum-js/pull/384)

Any feedback would be appreciated, Also let us know if you have any questions.

Thanks,  
Vignesh

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 11, 2019, 6:10am UTC](https://discuss.elastic.co/t/custom-transaction-names-with-rum/195574/3 "2019-09-11T06:10:19Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
