Files
danbooru/app/javascript/src/javascripts/new_relic.js
evazion 04cd6d0d3f newrelic: log screen resolution and pixel density.
Log the user's screen resolution and pixel density so we can make better
decisions about which screen sizes to support.
2021-09-25 06:46:25 -05:00

15 lines
641 B
JavaScript

class NewRelic {
static initialize_all() {
/* https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/setcustomattribute-browser-agent-api/ */
if (typeof window.newrelic === "object") {
window.newrelic.setCustomAttribute("screenWidth", window.screen.width);
window.newrelic.setCustomAttribute("screenHeight", window.screen.height);
window.newrelic.setCustomAttribute("screenResolution", `${window.screen.width}x${window.screen.height}`);
window.newrelic.setCustomAttribute("devicePixelRatio", window.devicePixelRatio);
}
}
}
NewRelic.initialize_all();
export default NewRelic;