Splunk AppDynamics

Unable to set a custom attribute after initial load for Next.js web app (RUM)

Ben_Howl
New Member

Hey all,

Tech stack: Next.js 13 (pages router)

I've been following the guide https://docs.appdynamics.com/display/GOVAPM234/Add+Custom+User+Data+to+a+Page+Browser+Snapshot to set custom attributes.  

On the initial page I load the AppDynamics script provided below

window['adrum-start-time'] = new Date().getTime()
;((config) => {
  config.appKey = 'XXX'
  config.adrumExtUrlHttp = 'http://cdn.appdynamics.com'
  config.adrumExtUrlHttps = 'https://cdn.appdynamics.com'
  config.beaconUrlHttp = 'http://syd-col.eum-appdynamics.com'
  config.beaconUrlHttps = 'https://syd-col.eum-appdynamics.com'
  config.useHTTPSAlways = true
  config.xd = { enable: true }
  config.resTiming = { bufSize: 200, clearResTimingOnBeaconSend: true }
  config.maxUrlLength = 512;
  config.userEventInfo = {
    PageView: getAppDynamicsUserInfo(),
    VPageView: getAppDynamicsUserInfo(),
  }
})(window['adrum-config'] || (window['adrum-config'] = {}))
getAppDynamicsUserInfo is a function attached to window and will return the attribute sessionId always and if available, another attribute called customerId.

On the initial page load, the sessionId is sent and viewable on AppDynamics Analyze view. When I get to the page where the customerId is available, it is not sent to AppDynamics. 

If I inspect window["adrum-config"] or use ADRUM.conf.userConf, I can see both sessionId and customerId.

In the above script I've tried just setting PageView and just setting VPageView

In terms of methods of loading the above script, I've used the Next.js Script component and tried the following:

  • Load the above as an external script file on different pages (different react components)
  • Load the above in different versions of the same script file (different names) on different pages
  • Added the above script into a React component and loaded the component on different pages

I've also tried to use the AJAX method to intercept http calls. It intercepts the http call but does not result in sending the user data to AppDynamics. 

In addition to trying to set it via config.userInfo as above, I've tried to use the following options as well. 

(function (info) {
   info.PageView = getAppDynamicsUserInfo
   info.VPageView = getAppDynamicsUserInfo
})(config.userEventInfo || (config.userEventInfo = {}))

(function (info) {
   info.PageView = getAppDynamicsUserInfo()
   info.VPageView = getAppDynamicsUserInfo()
})(config.userEventInfo || (config.userEventInfo = {}))

​

Any help is appreciated, thank you 🙂 

Labels (1)
0 Karma

iamryan
Community Manager
Community Manager

HI @Ben.Howl,

Thanks for asking your question on the Community. It's been a few days and the Community has not jumped in, I wanted to let you know you can always contact AppD Support or even your AppD CSM.

How do I submit a Support ticket? An FAQ 

If you find a solution or any other bit of help to this question, it would be helpful if you could come back and share that as a reply. 

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Index This | What travels the world but is also stuck in place?

April 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...