I have got a couple of queries on whether we can set the custom page name for AJAX events or not. The documentation around it is a bit confusing (but we will get that sorted out very soon) but we can set custom page names for AJAX call as well.
You need to use 'userPageName' attribute in window[
'adrum-config'
] > userEventInfo
for the AJAX event. Very much similar to the 'PageView' event config shown in the link below.
https://docs.appdynamics.com/display/PRO43/Add+Custom+User+Data+to+a+Page+Browser+Snapshot
The example to set the custom page name for AJAX event would be:
<head> ... ... <script> window['adrum-start-time'] = new Date().getTime(); window['adrum-config'] = { userEventInfo: { "Ajax" : function(context) { return { userPageName: "Search" } } } }; ... ... (function(config){ config.appKey = 'YOUR-EUM-APP-KEY'; config.adrumExtUrlHttp = 'http://cdn.appdynamics.com'; config.adrumExtUrlHttps = 'https://cdn.appdynamics.com'; config.beaconUrlHttp = 'http://col.eum-appdynamics.com'; config.beaconUrlHttps = 'https://col.eum-appdynamics.com'; config.xd = {enable : false}; })(window['adrum-config'] || (window['adrum-config'] = {})); ... ... </script> </head>
This will name all the AJAX events as 'Search' but you can use JS conditions to set it whatever based on the context.url value.
Things to be noted here are:
- This config(in bold) should go before the js agent instrumentation code.
- This config works v4.3 JS Agent onwards.
Hope this will help.