Not a customer? Click the 'Start a free trial' link to begin a 30-day SaaS trial of our product and to join our community.
Existing Cisco AppDynamics customers should click the 'Sign In' button to authenticate to access the community
on 06-26-2017 10:01 AM - edited on 01-29-2019 10:22 AM by Nina.Wolinsky
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:
I dont see username or id under 'es' section of payload...does that mean I cant capture them into appDynamics?
Hi Manoj,
No user data is captured in your case. Beacon is missing "ud".
How are you attaching userdata?
Regards,
Gaurav Soni
the username was within a span tag. So to pull that data you need to grab the innerText and not the value of the element. this was able to help. Thanks for your offer to help anyways.
"username": document.getElementById("AccountSummary_AccountHolderNameValue").innerText
Here is a link to it https://stackoverflow.com/questions/10343838/get-value-of-span-text
Hi Manoj,
I am not sure if the document element might even be available at that point. As this configuration go very early in the page. Can you give me the link to the page source?
Regards,
Gaurav
Hi Gaurav ,
I am using the adrum js in our main application for BRUM implmentation , on the request payload very less infromation is passed on the production envirnoment while on the other enviroments all the datas like userData, GEO data and XHR information is getting passed but on the production URL , its sending very less data ,surprisingly for some user its capturing the data while for some users its not at all capturing any information.
Request Payload :
{"vr":"4.4.1.154","dt":"R","rg":"0","es":[{"eg":"1","et":3,"eu":"0://1/2/#3","ts":1537102921828,"mg":"2","au":"0://1/2/#3","at":0,"mx":{"PLT":3283,"DDT":2884,"DRT":2923,"DPT":39,"DOM":2923,"PLC":1,"VDC":0},"si":1162}],"ai":"a0c9ece6_b4d2_eb0d_9724_73561187347d","ge":{"c":"DXB","r":"DXB","t":"DXB"},"gs":["4811d957-c8fb-48ef-9d4d-0f471ef57892","302a6294_c2d9_e808_b82e_cd68845ed80e","3e19a21b_a947_eb19_d59e_b189d2447fcd"],"up":["https","<appl_url>","<context>","/"]}
Script code is used as same you have mentioned in the previous post :
<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>
Can you please highlight the root cause of this behaviour?
Thank you! Your submission has been received!
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form