Before send and transport
Before send
Enable event access and modification before sending to Coralogix, supporting content modification, and event discarding.
CoralogixRum.init({
// ...
beforeSend: (event) => {
// Discard events from @company.com users.
if (event.session_context.user_email?.endsWith('@company.com')) {
return null;
}
// Redact sensitive information from the page URL.
event.page_context.page_url = event.page_context.page_url.replace('sensitive-info', 'redacted');
return event;
},
});
Proxy URL
Set proxyUrl to send the SDK's data to a server you run, instead of directly to Coralogix. The
proxy must relay each request to the Coralogix ingress. The SDK sends every request as a POST, and
names its Coralogix endpoint in a cxforward query parameter, for example
https://www.example.com/rum?cxforward=https%3A%2F%2Fingress.eu1.rum-ingress-coralogix.com%2Fbrowser%2Fv1beta%2Flogs.
Because the SDK appends that parameter to proxyUrl as written, do not give proxyUrl a query
string of its own.
CoralogixRum.init({
// ...
coralogixDomain: 'EU1',
proxyUrl: 'https://www.example.com/rum',
});
For what the proxy must do with each request, where to host it, and complete Node.js and Nginx examples, see the Proxy URL guide.
ignoreProxyUrlParams
Set ignoreProxyUrlParams: true to send requests to proxyUrl exactly as written, without the
cxforward parameter. Your proxy then has to tell RUM events from session recording uploads by
their content type. Defaults to false.
CoralogixRum.init({
// ...
coralogixDomain: 'EU1',
proxyUrl: 'https://proxy.mycompany.com/rum',
ignoreProxyUrlParams: true,
});
Ingress URL
coralogixDomain resolves your account's ingress endpoint from the supported Coralogix regions and is
the standard way to configure it. coralogixDomainUrl accepts an explicit ingress URL, for accounts
whose endpoint has no corresponding coralogixDomain key:
CoralogixRum.init({
// ...
coralogixDomainUrl: 'https://ingress.<region>.rum-ingress-coralogix.com',
});
One of coralogixDomain or coralogixDomainUrl is required; initialization is aborted with a console
error when neither is provided. When both are provided, coralogixDomainUrl takes precedence.
The value must be an absolute http(s) URL with no query string or fragment: the SDK appends its
endpoint paths to it, so a ? or # would truncate the resulting request URL. A trailing slash is
accepted and normalized.
The option composes with Proxy URL: the configured ingress URL is the value the SDK
places in the request's cxforward parameter.
Collect IP data
Determines whether the SDK should collect the user's IP address and corresponding geolocation data. Defaults to true.
CoralogixRum.init({
// ...
collectIPData: true,
});
SDK fetch priority
Controls the priority hint applied to the SDK's own network requests — the internal calls it makes to send logs and recordings to Coralogix. This is unrelated to your application's requests. When omitted, the browser uses its default (Chromium treats this as high), which can cause SDK traffic to compete with your application's critical requests. Set sdkFetchPriority: 'low' to deprioritize SDK traffic.
Accepted values: 'low', 'high', or 'auto' (default).
CoralogixRum.init({
// ...
sdkFetchPriority: 'low',
});
The priority hint only works in Chromium browsers (Chrome/Edge 101+) and is a no-op elsewhere. We type this option with our own SdkFetchPriority alias instead of the DOM RequestPriority type, so it still compiles on older TypeScript versions (the SDK supports >= 4.5.2).