Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

I captured this NREUM thingy and don't know what it does


#1

Hello,

I was browsing through the web and accidentally clicked on a site which was looking suspicous. So as it is typical for me, I panicked and was doing research about the website.

I captured this JavaScript snippet from the website and was unsure if it is something safe or malicous.
A short research on keywords brought me to New Relic. Can anyone tell me what this does and if it’s save?

(window.NREUM || (NREUM = {})).loader_config = {
xpid: “UgMEWVVbGwAIUFNXDwY=”
};
window.NREUM || (NREUM = {}), __nr_require = function(t, e, n) {
function r(n) {
if (!e[n]) {
var o = e[n] = {
exports: {}
};
t[n][0].call(o.exports, function(e) {
var o = t[n][1][e];
return r(o ? o : e)
}, o, o.exports)
}
return e[n].exports
}
if (“function” == typeof __nr_require) return __nr_require;
for (var o = 0; o < n.length; o++) r(n[o]);
return r
}({
1: [function(t, e) {
function n(t, e, n) {
n || (n = {});
for (var r = o[t], a = r && r.length || 0, s = n[i] || (n[i] = {}), u = 0; a > u; u++) r[u].apply(s, e);
return s
}
function r(t, e) {
var n = o[t] || (o[t] = []);
n.push(e)
}
var o = {},
i = “nr@context”;
e.exports = {
on: r,
emit: n
}
}, {}],
2: [function(t) {
function e(t, e, n, i, s) {
return u ? u -= 1 : r(“err”, [s || new UncaughtException(t, e, n)]), “function” == typeof a ? a.apply(this, o(arguments)) : !1
}
function UncaughtException(t, e, n) {
this.message = t || “Uncaught error with no additional information”, this.sourceURL = e, this.line = n
}
function n(t) {
r(“err”, [t, (new Date).getTime()])
}
var r = t(“handle”),
o = t(6),
i = t(5),
a = window.onerror,
s = !1,
u = 0;
t(“loader”).features.push(“err”), window.onerror = e, NREUM.noticeError = n;
try {
throw new Error
} catch (d) {
“stack” in d && (t(1), t(2), “addEventListener” in window && t(3), window.XMLHttpRequest && XMLHttpRequest.prototype && XMLHttpRequest.prototype.addEventListener && t(4), s = !0)
}
i.on(“fn-start”, function() {
s && (u += 1)
}), i.on(“fn-err”, function(t, e, r) {
s && (this.thrown = !0, n®)
}), i.on(“fn-end”, function() {
s && !this.thrown && u > 0 && (u -= 1)
}), i.on(“internal-error”, function(t) {
r(“ierr”, [t, (new Date).getTime(), !0])
})
}, {
1: 5,
2: 4,
3: 3,
4: 6,
5: 1,
6: 14,
handle: “D5DuLP”,
loader: “G9z0Bl”
}],
3: [function(t) {
function e(t) {
r.inPlace(t, [“addEventListener”, “removeEventListener”], “-”, n)
}
function n(t) {
return t[1]
}
var r = t(1),
o = (t(3), t(2));
if (e(window), “getPrototypeOf” in Object) {
for (var i = document; i && !i.hasOwnProperty(“addEventListener”):wink: i = Object.getPrototypeOf(i);
i && e(i);
for (var a = XMLHttpRequest.prototype; a && !a.hasOwnProperty(“addEventListener”):wink: a = Object.getPrototypeOf(a);
a && e(a)
} else XMLHttpRequest.prototype.hasOwnProperty(“addEventListener”) && e(XMLHttpRequest.prototype);
o.on(“addEventListener-start”, function(t) {
if (t[1]) {
var e = t[1];
“function” == typeof e ? this.wrapped = e[“nr@wrapped”] ? t[1] = e[“nr@wrapped”] : e[“nr@wrapped”] = t[1] = r(e, “fn-”) : “function” == typeof e.handleEvent && r.inPlace(e, [“handleEvent”], “fn-”)
}
}), o.on(“removeEventListener-start”, function(t) {
var e = this.wrapped;
e && (t[1] = e)
})
}, {
1: 15,
2: 1,
3: 14
}],
4: [function(t) {
var e = (t(3), t(1)),
n = t(2);
e.inPlace(window, [“requestAnimationFrame”, “mozRequestAnimationFrame”, “webkitRequestAnimationFrame”, “msRequestAnimationFrame”], “raf-”), n.on(“raf-start”, function(t) {
t[0] = e(t[0], “fn-”)
})
}, {
1: 15,
2: 1,
3: 14
}],
5: [function(t) {
function e(t) {
var e = t[0];
“string” == typeof e && (e = new Function(e)), t[0] = n(e, “fn-”)
}
var n = (t(3), t(1)),
r = t(2);
n.inPlace(window, [“setTimeout”, “setInterval”, “setImmediate”], “setTimer-”), r.on(“setTimer-start”, e)
}, {
1: 15,
2: 1,
3: 14
}],
6: [function(t) {
function e() {
o.inPlace(this, s, “fn-”)
}
function n(t, e) {
o.inPlace(e, [“onreadystatechange”], “fn-”)
}
function r(t, e) {
return e
}
var o = t(1),
i = t(2),
a = window.XMLHttpRequest,
s = [“onload”, “onerror”, “onabort”, “onloadstart”, “onloadend”, “onprogress”, “ontimeout”];
window.XMLHttpRequest = function(t) {
var n = new a(t);
try {
i.emit(“new-xhr”, [], n), o.inPlace(n, [“addEventListener”, “removeEventListener”], “-”, function(t, e) {
return e
}), n.addEventListener(“readystatechange”, e, !1)
} catch ® {
try {
i.emit(“internal-error”, r)
} catch (s) {}
}
return n
}, window.XMLHttpRequest.prototype = a.prototype, o.inPlace(XMLHttpRequest.prototype, [“open”, “send”], “-xhr-”, r), i.on(“send-xhr-start”, n), i.on(“open-xhr-start”, n)
}, {
1: 15,
2: 1
}],
7: [function(t) {
function e() {
function e(t) {
if (“string” == typeof t && t.length) return t.length;
if (“object” != typeof t) return void 0;
if (“undefined” != typeof ArrayBuffer && t instanceof ArrayBuffer && t.byteLength) return t.byteLength;
if (“undefined” != typeof Blob && t instanceof Blob && t.size) return t.size;
if (“undefined” != typeof FormData && t instanceof FormData) return void 0;
try {
return JSON.stringify(t).length
} catch (e) {
return void 0
}
}
function n(t) {
var n = this.params,
r = this.metrics;
if (!this.ended) {
this.ended = !0;
for (var i = 0; u > i; i++) t.removeEventListener(s[i], this.listener, !1);
if (!n.aborted) {
if (r.duration = (new Date).getTime() - this.startTime, 4 === t.readyState) {
n.status = t.status;
var a = t.responseType,
d = “arraybuffer” === a || “blob” === a || “json” === a ? t.response : t.responseText,
f = e(d);
if (f && (r.rxSize = f), this.sameOrigin) {
var c = t.getResponseHeader(“X-NewRelic-App-Data”);
c && (n.cat = c.split(", “).pop())
}
} else n.status = 0;
r.cbTime = this.cbTime, o(“xhr”, [n, r])
}
}
}
function r(t, e) {
var n = i(e),
r = t.params;
r.host = n.hostname + “:” + n.port, r.pathname = n.pathname, t.sameOrigin = n.sameOrigin
}
t(“loader”).features.push(“xhr”);
var o = t(“handle”),
i = t(1),
a = t(5),
s = [“load”, “error”, “abort”, “timeout”],
u = s.length,
d = t(2);
t(3), t(4), a.on(“new-xhr”, function() {
this.totalCbs = 0, this.called = 0, this.cbTime = 0, this.end = n, this.ended = !1, this.xhrGuids = {}
}), a.on(“open-xhr-start”, function(t) {
this.params = {
method: t[0]
}, r(this, t[1]), this.metrics = {}
}), a.on(“open-xhr-end”, function(t, e) {
“loader_config” in NREUM && “xpid” in NREUM.loader_config && this.sameOrigin && e.setRequestHeader(“X-NewRelic-ID”, NREUM.loader_config.xpid)
}), a.on(“send-xhr-start”, function(t, n) {
var r = this.metrics,
o = t[0],
i = this;
if (r && o) {
var d = e(o);
d && (r.txSize = d)
}
this.startTime = (new Date).getTime(), this.listener = function(t) {
try {
“abort” === t.type && (i.params.aborted = !0), (“load” !== t.type || i.called === i.totalCbs && (i.onloadCalled || “function” != typeof n.onload)) && i.end(n)
} catch (e) {
try {
a.emit(“internal-error”, e)
} catch ® {}
}
};
for (var f = 0; u > f; f++) n.addEventListener(s[f], this.listener, !1)
}), a.on(“xhr-cb-time”, function(t, e, n) {
this.cbTime += t, e ? this.onloadCalled = !0 : this.called += 1, this.called !== this.totalCbs || !this.onloadCalled && “function” == typeof n.onload || this.end(n)
}), a.on(“xhr-load-added”, function(t, e) {
var n = “” + d(t) + !! e;
this.xhrGuids && !this.xhrGuids[n] && (this.xhrGuids[n] = !0, this.totalCbs += 1)
}), a.on(“xhr-load-removed”, function(t, e) {
var n = “” + d(t) + !! e;
this.xhrGuids && this.xhrGuids[n] && (delete this.xhrGuids[n], this.totalCbs -= 1)
}), a.on(“addEventListener-end”, function(t, e) {
e instanceof XMLHttpRequest && “load” === t[0] && a.emit(“xhr-load-added”, [t[1], t[2]], e)
}), a.on(“removeEventListener-end”, function(t, e) {
e instanceof XMLHttpRequest && “load” === t[0] && a.emit(“xhr-load-removed”, [t[1], t[2]], e)
}), a.on(“fn-start”, function(t, e, n) {
e instanceof XMLHttpRequest && (“onload” === n && (this.onload = !0), (“load” === (t[0] && t[0].type) || this.onload) && (this.xhrCbStart = (new Date).getTime()))
}), a.on(“fn-end”, function(t, e) {
this.xhrCbStart && a.emit(“xhr-cb-time”, [(new Date).getTime() - this.xhrCbStart, this.onload, e], e)
})
}
window.XMLHttpRequest && XMLHttpRequest.prototype && XMLHttpRequest.prototype.addEventListener && !/CriOS/.test(navigator.userAgent) && e()
}, {
1: 8,
2: 11,
3: 3,
4: 6,
5: 1,
handle: “D5DuLP”,
loader: “G9z0Bl”
}],
8: [function(t, e) {
e.exports = function(t) {
var e = document.createElement(“a”),
n = window.location,
r = {};
e.href = t, r.port = e.port;
var o = e.href.split(”://");
return !r.port && o[1] && (r.port = o[1].split("/")[0].split(":")[1]), r.port && “0” !== r.port || (r.port = “https” === o[0] ? “443” : “80”), r.hostname = e.hostname || n.hostname, r.pathname = e.pathname, “/” !== r.pathname.charAt(0) && (r.pathname = “/” + r.pathname), r.sameOrigin = !e.hostname || e.hostname === document.domain && e.port === n.port && e.protocol === n.protocol, r
}
}, {}],
handle: [function(t, e) {
e.exports = t(“D5DuLP”)
}, {}],
D5DuLP: [function(t, e) {
function n(t, e) {
var n = r[t];
return n ? n.apply(this, e) : (o[t] || (o[t] = []), void o[t].push(e))
}
var r = {},
o = {};
e.exports = n, n.queues = o, n.handlers = r
}, {}],
11: [function(t, e) {
function n(t) {
if (!t || “object” != typeof t && “function” != typeof t) return -1;
if (t === window) return 0;
if (o.call(t, “__nr”)) return t.__nr;
try {
return Object.defineProperty(t, “__nr”, {
value: r,
writable: !0,
enumerable: !1
}), r
} catch (e) {
return t.__nr = r, r
} finally {
r += 1
}
}
var r = 1,
o = Object.prototype.hasOwnProperty;
e.exports = n
}, {}],
loader: [function(t, e) {
e.exports = t(“G9z0Bl”)
}, {}],
G9z0Bl: [function(t, e) {
function n() {
var t = p.info = NREUM.info;
if (t && t.agent && t.licenseKey && t.applicationID && u && u.body) {
p.proto = “https” === c.split(":")[0] || t.sslForHttp ? “https://” : “http://”, a(“mark”, [“onload”, i()]);
var e = u.createElement(“script”);
e.src = p.proto + t.agent, u.body.appendChild(e)
}
}
function r() {
“complete” === u.readyState && o()
}
function o() {
a(“mark”, [“domContent”, i()])
}
function i() {
return (new Date).getTime()
}
var a = t(“handle”),
s = window,
u = s.document,
d = “addEventListener”,
f = “attachEvent”,
c = ("" + location).split("?")[0],
p = e.exports = {
offset: i(),
origin: c,
features: []
};
u[d] ? (u[d](“DOMContentLoaded”, o, !1), s[d](“load”, n, !1)) : (u[f](“onreadystatechange”, r), s[f](“onload”, n)), a(“mark”, [“firstbyte”, i()])
}, {
handle: “D5DuLP”
}],
14: [function(t, e) {
function n(t, e, n) {
e || (e = 0), “undefined” == typeof n && (n = t ? t.length : 0);
for (var r = -1, o = n - e || 0, i = Array(0 > o ? 0 : o); ++r < o;) i[r] = t[e + r];
return i
}
e.exports = n
}, {}],
15: [function(t, e) {
function n(t, e, r, s) {
function nrWrapper() {
try {
var n, a = u(arguments),
d = this,
f = r && r(a, d) || {}
} catch © {
i([c, “”, [a, d, s], f])
}
o(e + “start”, [a, d, s], f);
try {
return n = t.apply(d, a)
} catch § {
throw o(e + “err”, [a, d, p], f), p
} finally {
o(e + “end”, [a, d, n], f)
}
}
return a(t) ? t : (e || (e = “”), nrWrapper[n.flag] = !0, nrWrapper)
}
function r(t, e, r, o) {
r || (r = “”);
var i, s, u, d = “-” === r.charAt(0);
for (u = 0; u < e.length; u++) s = e[u], i = t[s], a(i) || (t[s] = n(i, d ? s + r : r, o, s, t))
}
function o(t, e, n) {
try {
s.emit(t, e, n)
} catch ® {
i([r, t, e, n])
}
}
function i(t) {
try {
s.emit(“internal-error”, t)
} catch (e) {}
}
function a(t) {
return !(t && “function” == typeof t && t.apply && !t[n.flag])
}
var s = t(1),
u = t(2);
e.exports = n, n.inPlace = r, n.flag = “nr@wrapper”
}, {
1: 1,
2: 14
}]
}, {}, [“G9z0Bl”, 2, 7]);

Thanks for any help.


#2

Hi @Neutron11

The code you have pulled out of their page is New Relic Browser monitoring. This is Javascript which lets the website track the performance of pages for their live sites and for the customers using it.

It provides performance data back for how long the page took to load, where in the world you are from and time each element loading to show where any degraded performance may be.

You can find out more information about this product at

Does this answer your question?


#3

Hello,

I see, so nothing to worry about, good.

However is it a cookie or just a feature running on the site?


#4

It’s Javascript timing the elements as they are served. As far as I understand our implementation, a cookie should only ever be used in the case that the page being served is particularly slow and the connectivity beacon passes a value between itself and the beacon when tracking a transaction trace.

So from my understanding it should be occasionally a cookie but majority of the time it runs clean within the browser and reports the data to our servers via a connection to our beacon.

I hope this helps answer your questions.


#5

Hi again @Neutron11

To be complete I wanted to double check this information with our Browser team, I have been told that cookies are also set for timing sessions aswell, so a cookie will alway be created, but we do not track any personal details.

We have a public facing documentation specifically for cookies and other security related questions.

https://docs.newrelic.com/docs/browser/new-relic-browser/performance-quality/security-new-relic-browser#cookies


#6

Okay I understand the concept of this thing now :slight_smile:

Do you know how this NREUM cookie is called in browser when I view my cookies?


#7

Hi @Neutron11

This page should hopefully answer any cookie related questions.

https://docs.newrelic.com/docs/browser/new-relic-browser/page-load-timing-resources/new-relic-cookies


#8

Why is function nrWrapper() { not minified?


#9

Hi @oudenniel, the New Relic Javascript loader in the page is minified. Are you seeing some issue with this minification?


#10

The content of the file was in our gulp minifaction process and with diff it showed smaller filesize and then i saw two functions not minified. Just a detail, functions itselfare not poluting anything more then window.NREUM


#11

Hi @oudenniel, thanks for checking. Our minification choices for the Javascript are intentional. We do leave a few functions expanded but the majority are minified; this balances keeping a small size with debugging capability.


#12

I moved a post to a new topic: Javascript error occurring


#13

A post was split to a new topic: Browser issue with JSON encoding