# Autoinjection script with custom context path

**URL:** <https://community.dynatrace.com/t/autoinjection-script-with-custom-context-path/47824>\
**Category:** Open Q&A\
**Tags:** oneagent, processes\
**Created:** [September 19, 2024, 2:26am UTC](https://community.dynatrace.com/t/autoinjection-script-with-custom-context-path/47824 "2024-09-19T02:26:50Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![viveksingh87](https://avatars.discourse-cdn.com/v4/letter/v/4af34b/32.png) [@viveksingh87](https://community.dynatrace.com/u/viveksingh87)\
**Post date:** [September 19, 2024, 2:26am UTC](https://community.dynatrace.com/t/autoinjection-script-with-custom-context-path/47824/1 "2024-09-19T02:26:50Z")

</div>

Hi,

By default dynatrace scripts are injected into head section with root context path like

\<script type=“text/javascript” src=“/ruxitagentjs\_ICANVfqru\_1029924090310435ssd4.js”…\>

I was looking in Dynatrace settings where I can define context path so that scripts injected will be with custom context path (/webapp/bio/).

\<script type=“text/javascript” src=“/webapp/bio/ruxitagentjs\_ICANVfqru\_10299240903104354.js”…\>

---

<div class="post-metadata">

**Author:** ![erh\_inetum](https://avatars.discourse-cdn.com/v4/letter/e/48db29/32.png) [@erh\_inetum](https://community.dynatrace.com/u/erh_inetum)\
**Post date:** [September 19, 2024, 4:49am UTC](https://community.dynatrace.com/t/autoinjection-script-with-custom-context-path/47824/2 "2024-09-19T04:49:35Z")

</div>

Hi&nbsp;[@viveksingh87](https://community.dynatrace.com/user/80906)&nbsp;,

You can change it&nbsp; going to Settings of your application,&nbsp; Capturing \> Advanced setup, RUM monitoring code section and specify path for RUM monitoring code:

 ![erh_inetum_0-1726721233014.png](https://global.discourse-cdn.com/dynatrace/original/2X/a/a9a01f052b41e148b3b438584a138f5f7392ce1f.png)

Hope it helps.

Regards,

Elena.

---

<div class="post-metadata">

**Author:** ![PacoPorro](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/pacoporro/32/36087_2.png) [@PacoPorro](https://community.dynatrace.com/u/PacoPorro)\
**Post date:** [September 19, 2024, 6:35am UTC](https://community.dynatrace.com/t/autoinjection-script-with-custom-context-path/47824/3 "2024-09-19T06:35:15Z")

</div>

Be aware that the path Elena mention does not need to exist, the oneagent will take care of the new path.

---

<div class="post-metadata">

**Author:** ![viveksingh87](https://avatars.discourse-cdn.com/v4/letter/v/4af34b/32.png) [@viveksingh87](https://community.dynatrace.com/u/viveksingh87)\
**Post date:** [September 19, 2024, 10:09pm UTC](https://community.dynatrace.com/t/autoinjection-script-with-custom-context-path/47824/4 "2024-09-19T22:09:56Z")

</div>

Thank you Elena,

I have also tried configuring “/webapp/bio/” under&nbsp;Capturing \> Advanced setup and checked application head tag in browser still script does not have context path. Does one agent look for context path from any tag on index.html

\<script type=“text/javascript” src=“/ruxitagentjs\_ICANVfqru\_1029924090310435ssd4.js”…\>

---

<div class="post-metadata">

**Author:** ![erh\_inetum](https://avatars.discourse-cdn.com/v4/letter/e/48db29/32.png) [@erh\_inetum](https://community.dynatrace.com/u/erh_inetum)\
**Post date:** [September 20, 2024, 4:35am UTC](https://community.dynatrace.com/t/autoinjection-script-with-custom-context-path/47824/5 "2024-09-20T04:35:46Z")

</div>

Hi&nbsp;[@viveksingh87](https://community.dynatrace.com/user/80906)&nbsp;,

When you say “Does one agent look for context path from any tag on index.html”,&nbsp;do you mean to place ruxit on index.html? If you mean this, you can define a custom injection rule to inject ruxitagent on index.html:

 ![erh_inetum_0-1726806550402.png](https://global.discourse-cdn.com/dynatrace/original/3X/e/1/e14c3085a3157bc84fe7fac746939abb310dce92.png)

Regards,

Elena.

---

<div class="post-metadata">

**Author:** ![viveksingh87](https://avatars.discourse-cdn.com/v4/letter/v/4af34b/32.png) [@viveksingh87](https://community.dynatrace.com/u/viveksingh87)\
**Post date:** [September 24, 2024, 9:56pm UTC](https://community.dynatrace.com/t/autoinjection-script-with-custom-context-path/47824/6 "2024-09-24T21:56:32Z")

</div>

I have setup that as below

 ![viveksingh87_0-1727214869103.png](https://global.discourse-cdn.com/dynatrace/original/3X/b/6/b634fed1f1600d156f789f6aa93635123995bfcd.png)

but even after that script does not prefix context path “/webapp/biometric/”

 ![viveksingh87_1-1727214928356.png](https://global.discourse-cdn.com/dynatrace/original/3X/3/5/3573a0291291234a58fc44e6e2be929af69612f3.png)

As a result script failed to download

 ![viveksingh87_2-1727214977787.png](https://global.discourse-cdn.com/dynatrace/original/2X/4/43e4a730fe10862918fc5e4486d7f6d1f0f94e7a.png)

---

<div class="post-metadata">

**Author:** ![erh\_inetum](https://avatars.discourse-cdn.com/v4/letter/e/48db29/32.png) [@erh\_inetum](https://community.dynatrace.com/u/erh_inetum)\
**Post date:** [September 25, 2024, 5:23am UTC](https://community.dynatrace.com/t/autoinjection-script-with-custom-context-path/47824/7 "2024-09-25T05:23:13Z")

</div>

Hi&nbsp;[@viveksingh87](https://community.dynatrace.com/user/80906)&nbsp;,

That you’re trying to get is inject ruxit on page “/webapp/bio/” and change the ruxitagent path from&nbsp;“/ruxitagentjs\_…js” to “/webapp/bio/ruxitagentjs\_…js”, right?

Have you tried to specify the path from RUM monitoring code in Advance Settings and also defining the custom injection rule?

Regards,

Elena.

---

<div class="post-metadata">

**Author:** ![viveksingh87](https://avatars.discourse-cdn.com/v4/letter/v/4af34b/32.png) [@viveksingh87](https://community.dynatrace.com/u/viveksingh87)\
**Post date:** [September 26, 2024, 12:04am UTC](https://community.dynatrace.com/t/autoinjection-script-with-custom-context-path/47824/8 "2024-09-26T00:04:01Z")

</div>

Yes I have tried that. I have updated the&nbsp;path from RUM monitoring code in Advance Settings&nbsp;and also defined the custom injection rule.

---

<div class="post-metadata">

**Author:** ![erh\_inetum](https://avatars.discourse-cdn.com/v4/letter/e/48db29/32.png) [@erh\_inetum](https://community.dynatrace.com/u/erh_inetum)\
**Post date:** [September 30, 2024, 4:41am UTC](https://community.dynatrace.com/t/autoinjection-script-with-custom-context-path/47824/9 "2024-09-30T04:41:32Z")

</div>

Hi&nbsp;[@viveksingh87](https://community.dynatrace.com/user/80906)&nbsp;,

If you go to Application \> your\_app \> Settings \> Injection, Manual insertion, do you see the desired path?

Something like

\<script type=“text/javascript” _src="/webapp/bio/ruxitagentjs_\_ICANVfghqru\_10299240903104354.js" data-dtconfig="app=---…\</script\>

Maybe you have to copy the snippet in your page. As far as I know it shouldn´t required but you can test it.

Or someone can provide a better answer than mine.

Regards,

Elena.
