Skip to content

Commit

Permalink
fix: add json type header to beacon
Browse files Browse the repository at this point in the history
  • Loading branch information
chicharr committed Mar 6, 2024
1 parent e7f9357 commit 1bbd24f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/lib-franklin.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ export function sampleRUM(checkpoint, data) {
const pathBase = window.hlx.codeBasePath ? `${window.hlx.codeBasePath}/` : '';
// eslint-disable-next-line object-curly-newline, max-len
const body = JSON.stringify({ weight, id, referer: window.location.href, checkpoint: 'top', t: timeShift(), target: document.visibilityState });
const headers = { type: 'application/json' };
const url = new URL(`${pathBase}.rum/${weight}`, sampleRUM.collectBaseURL).href;
navigator.sendBeacon(url, body);
navigator.sendBeacon(url, new Blob([body], headers));
// eslint-disable-next-line max-statements-per-line, brace-style
window.addEventListener('load', () => {
sampleRUM('load');
Expand Down

0 comments on commit 1bbd24f

Please sign in to comment.