cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Amit.Jha
AppDynamics Team (Retired)

Question

 

 How do I add custom user data via automatic injection?

 

Answer

 

1. Navigate to the Browser App that is linked to the APM app and click on configuration > Configure and Download JavaScript Agent.


2. Expand the advanced section.

 

In the custom configuration box, add the following:

 

window['adrum-config'] = {
 userEventInfo: {
   "PageView": function(context) {
     return{
       userData: {
         page_title: "RandomGeneratedTest"
       }
     }
   }
 }
};

window['adrum-start-time'] = new Date().getTime();
(function(config){
   config.appKey = 'BD-AAB-XYZ-XYZ';
   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'] = {}));

 

3. Click on Save Config & Generate HTML Snippet.

4. Verify in the page source if the code is being successfully injected:

 

<html>
<head>
<script type='text/javascript'>
//<![CDATA[
window['adrum-start-time'] = new Date().getTime();
;(function(config){
config.appKey = 'BD-AAC-XYZ-XYZ';
config.beaconUrlHttp = 'http://col.eum-appdynamics.com';
config.beaconUrlHttps = 'https://col.eum-appdynamics.com';
config.adrumExtUrlHttp = 'http://cdn.appdynamics.com';
config.adrumExtUrlHttps = 'https://cdn.appdynamics.com';
config.xd = {enable : false};
})(window['adrum-config'] || (window['adrum-config'] = {}));
window['adrum-config'] = {
userEventInfo: {
"PageView": function(context) {
return{
userData: {
page_title: "RandomGeneratedTest"
}
}
}
}
};


 

This will make changes to the default JavaScript Agent code that is injected into the page source, allowing the user to see custom data addition in the page source.

Comments
Yaniv.Katz
Creator

Hi,

 

Thanks!

 

How can I control in case of on-prem in other aspects:

1. Addresses. There are six in the snippet: i.e. 

config.beaconUrlHttp

2. Additional java script code that I would like to add min the snippet as java script function. 

 

Thanks,

Yaniv

Amit.Jha
AppDynamics Team (Retired)

@Yaniv You can configure it in the controller admin.jsp. The beacon URLs will be picked from admin.jsp setting.

 

Could you please clarify on the second question.

Version history
Last update:
‎03-12-2018 04:52 AM
Updated by: