Alter or Eliminate the Page Title Captured in the Beacon
In a standard Browser RUM beacon, the value for document.title is collected as part of the data to be sent in the beacon. You may want to alter or eliminate the page title for security or privacy reasons.
You can choose to:
- Not collect a page title at all
- Use a title that is created by a function with 0 arguments
- Use a title that is an arbitrary string
Remove a Page Title
To remove the page title entirely, add the following snippet to your page before you inject the adrum.js script:
<head>
<script type='text/javascript' charset='UTF-8'>
(function (config) {
(function (page) {
page.captureTitle = false;
})(config.page || (config.page = {}));
})(window['adrum-config'] || (window['adrum-config'] = {}));
</script>
<script src='//cdn.appdynamics.com/adrum/adrum-latest.js' type='text/javascript' charset='UTF-8'></script>
...
</head>
Use a Page Title Created by a Function
To use a function with no arguments to create a page title, before you inject the adrum.js script, define your function and call it, as in this example:
<head>
<script type='text/javascript' charset='UTF-8'>
function title() { return document.title.split('-').slice(1,3).join('-'); } // define a function
(function (config) {
(function (page) {
page.title = title; // call your function
})(config.page || (config.page = {}));
})(window['adrum-config'] || (window['adrum-config'] = {}));
</script>
<script src='//cdn.appdynamics.com/adrum/adrum-latest.js' type='text/javascript' charset='UTF-8'/>
...
</head>
Something like this could be used, for example, to remove sensitive data from the page title.
Use an Arbitrary String as a Page Title
To use any arbitrary string as the page title, before you inject the adrum.js script, set page.title.
<head>
<script type='text/javascript' charset='UTF-8'>
(function (config) {
(function (page) {
page.title = "My Special Page Title";
})(config.page || (config.page = {}));
})(window['adrum-config'] || (window['adrum-config'] = {}));
</script>
<script src='//cdn.appdynamics.com/adrum/adrum-latest.js' type='text/javascript' charset='UTF-8'></script>
...
</head>
This would set the page title in the beacon to "My Special Page Title".