The user wants to add custom user data to a page browser snapshot and has followed the documentation for version 4.3. They are still unable to see the EUM custom user data attached to requests.
'es'[index] => 'ud'
A common mistake can be made when setting the Adrum config.
window['adrum-config'] = { userEventInfo: { "Ajax": function(context) { ... } } };
Set the window['adrum-config']
before the Adrum.js called.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <script> window['adrum-start-time'] = new Date().getTime(); window['adrum-config'] = { userEventInfo: { "Ajax": function(context) { return { userData: { email : "sample@example.com" } } } } }; (function(config){ config.appKey = 'AD-AAB-XXX-XXX'; 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'] = {})); if ('https:' === document.location.protocol) { document.write(unescape('%3Cscript') + " src='https://cdn.appdynamics.com/adrum/adrum-4.3.2.0.js' " + " type='text/javascript' charset='UTF-8'" + unescape('%3E%3C/script%3E')); } else { document.write(unescape('%3Cscript') + " src='http://cdn.appdynamics.com/adrum/adrum-4.3.2.0.js' " + " type='text/javascript' charset='UTF-8'" + unescape('%3E%3C/script%3E')); } </script> <script src="js/jquery.js"></script> </head> <body> ... ... ... </body> </html>
To dynamically set the user data at a later point in time, create a JSON structure before setting window['adrum-config']
and assign it to userData.
Later, update the user data when before the AJAX event is fired.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <script charset='UTF-8'> window['adrum-start-time'] = new Date().getTime(); var jsonData = {}; function addToMap(key, value) { jsonData[key] = value; } function getJsonData() { return jsonData; } window['adrum-config'] = { userEventInfo: { "Ajax": function(context) { return { userData: getJsonData() } } } }; (function(config){ config.appKey = 'AD-AAB-XXX-XXX'; 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'] = {})); if ('https:' === document.location.protocol) { document.write(unescape('%3Cscript') + " src='https://cdn.appdynamics.com/adrum/adrum-4.3.2.0.js' " + " type='text/javascript' charset='UTF-8'" + unescape('%3E%3C/script%3E')); } else { document.write(unescape('%3Cscript') + " src='http://cdn.appdynamics.com/adrum/adrum-4.3.2.0.js' " + " type='text/javascript' charset='UTF-8'" + unescape('%3E%3C/script%3E')); } </script> <script src="js/jquery.js"></script> </head> <body> <button onclick="make_calls()">Make Calls</button> <script type="text/javascript"> function make_calls(){ var random_number = Math.floor(Math.random() * 6) + 1; if (random_number%2==0){ addToMap("uname", "Mario"); }else{ addToMap("uname", "Luigi"); } $.ajax({ url: "http://localhost:8080/PersonalMusicManagerApp/trail1.action", success: function(result){ } }); } </script> </body> </html>
Related Links: