Adding Javascript to the HEAD of the document

31 views
Skip to first unread message

Jeffrey Dake

unread,
Jan 16, 2024, 1:15:21 PMJan 16
to uPortal Community
I am looking at adding New Relic Real User Monitoring as we switch from portlets to using web components.  New Relic wants you to add a script to the head of the document as high as you possibly can.  Is there a way to add custom javascript to the portal.  I saw some code in skin.xml and skinList.xml, but nothing I changed had any affect, so I might be looking in the wrong place.  Thanks for any guidance anyone has.

Benito Gonzalez

unread,
Feb 22, 2024, 12:28:26 PMFeb 22
to Jeffrey Dake, uPortal Community
Hi Jeffrey,

In your custom skin directory, you should find a file named skin.xml that looks close to https://github.com/uPortal-Project/uPortal/blob/master/uPortal-webapp/src/main/webapp/media/skins/respondr/defaultSkin/skin.xml. You can add a <js> tag that points to a file that will be imported into the <head> of the page. 

If your portal is using the "uPortal" context (most do), you might want to add something like:

<js  included="plain">/uPortal/scripts/newrelic.js</js>
<js  included="aggregated">/uPortal/scripts/newrelic.js</js>

This assumes the JS file is named newrelic.js and is in your uPortal scripts folder.

Hope this helps,
-bjagg

On Tue, Jan 16, 2024 at 10:15 AM Jeffrey Dake <jda...@gmail.com> wrote:
I am looking at adding New Relic Real User Monitoring as we switch from portlets to using web components.  New Relic wants you to add a script to the head of the document as high as you possibly can.  Is there a way to add custom javascript to the portal.  I saw some code in skin.xml and skinList.xml, but nothing I changed had any affect, so I might be looking in the wrong place.  Thanks for any guidance anyone has.

--
You received this message because you are subscribed to the Google Groups "uPortal Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to uportal-user...@apereo.org.
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/uportal-user/3d2919be-0876-4835-92ca-c9953c670315n%40apereo.org.
Reply all
Reply to author
Forward
0 new messages