Skip to content

Commit

Permalink
feat: add support for proper tracking in a speculative pre-rendering …
Browse files Browse the repository at this point in the history
…context
  • Loading branch information
ramboz committed Oct 5, 2024
1 parent 39adedb commit cc31e7c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,10 @@ export function setup() {
/* c8 ignore next 18 */
export function init() {
setup();
sampleRUM();
// Prerender-aware initialization
if (document.prerendering) {
document.addEventListener('prerenderingchange', sampleRUM, { once: true });
} else {
sampleRUM();
}
}

0 comments on commit cc31e7c

Please sign in to comment.