Knowledge Base

Showing results for 
Search instead for 
Did you mean: 

How do I set a custom page name for an AJAX call using JavaScript Agent?

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'] > userEventInfofor the AJAX event. Very much similar to the 'PageView' event config shown in the link below.


The example to set the custom page name for AJAX event would be:

	window['adrum-start-time'] = new Date().getTime();
	window['adrum-config'] = {
            userEventInfo: {
                "Ajax" : function(context) {
                    return {
                    	userPageName: "Search"
	    config.appKey = 'YOUR-EUM-APP-KEY';
	    config.adrumExtUrlHttp = '';
	    config.adrumExtUrlHttps = '';
	    config.beaconUrlHttp = '';
	    config.beaconUrlHttps = '';
	    config.xd = {enable : false};
	})(window['adrum-config'] || (window['adrum-config'] = {}));

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.

Version history
Revision #:
5 of 5
Last update:
‎02-21-2019 01:14 PM
Updated by:
Labels (1)
Tags (2)

Found this article helpful? Click the Thumbs Up button.
Have an additional comment? Post it below.
0 Kudos