Compatibility Configuration
Unfortunately, there are a few times where libraries used on the page don’t match with the way browser agent works. For those cases there are options to enable compatibility fixes which take a performance hit.
Prototype.js versions < 1.7.1
Prototype.js is a library that extends native JavaScript objects by adding new methods to the prototype of the objects. However as JavaScript evolves and new methods get added to the specification of the language (and therefore latest versions of browsers), the behaviour of these methods can be different than the one defined by the specification.
To fix these issues you can either upgrade to Prototype.js versions >= 1.7.1 or if that is not feasible configure the agent accordingly:
Version | Notes | Configuration |
---|---|---|
1.7.0 (inc. RC) | Has non-ES5 compliant Function.prototype.bind implementation. | "compat":["bind"] |
1.6.1 and older | In addition to bind, Prototype.js adds of toJSON to all of the objects which is used in ES5 to customise an object’s value when they are turned into a string. | "compat":["bind","json"] |
Example of using Prototype.js 1.6.1 with browser agent:
<script src="https://browser.plumbr.io/pa.js"
data-plumbr='{"accountId":"abcdef...","serverUrl":"https://bdr.plumbr.io","compat":["bind","json"]}'>
</script>
<script src="https://ajax.googleapis.com/ajax/libs/prototype/1.6.1.0/prototype.js"></script>
In-HTML Event Handlers
Event listeners defined like <a onclick="doSomething(); return false"></a>
are tightly coupled to the HTML, so we need to jump through some hoops in order to gather transactions from these interactions. As part of this we wrap your code with instrumented_with_plumbr
method.
If you do not want this behaviour, or you never use it and want a small performance gain, you can add "inlineEvents": false
to your browser agent config. (Note: Any activity happening in inline event listeners will then be linked to the previous transaction.)
In case you do changes to the onX attribute after we instrument it, you can enable extra watchers by adding "inlineEventChanges": true
to the configuration, which re-instruments your code after changes.