Skip to content

Commit

Permalink
fix(index): better way of setting search parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
trieloff committed Sep 11, 2024
1 parent 4e0d22d commit 584de2c
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ export function sampleRUM(checkpoint, data) {
sampleRUM.sendPing = (ck, time, pingData = {}) => {
// eslint-disable-next-line max-len, object-curly-newline
const rumData = JSON.stringify({ weight, id, referer: window.location.href, checkpoint: ck, t: time, ...pingData });
const u = new URL(`.rum/${weight}`, sampleRUM.collectBaseURL);
u.searchParams = window.RUM_PARAMS || new URLSearchParams();
const { href: url, origin } = u;
const { href: url, origin } = new URL(`.rum/${weight}?${(window.RUM_PARAMS || new URLSearchParams()).toString()}`, sampleRUM.collectBaseURL);
const body = origin === window.location.origin ? new Blob([rumData], { type: 'application/json' }) : rumData;
navigator.sendBeacon(url, body);
// eslint-disable-next-line no-console
Expand Down

0 comments on commit 584de2c

Please sign in to comment.