feat(tracker): update SetPageLocation referrer value for single-page routing

This commit is contained in:
Alex Kaminskii 2023-02-14 17:33:49 +01:00 committed by Taha Yassine Kraiem
parent 1e2a5f2644
commit 7e82dce53a

View file

@ -5,13 +5,15 @@ import { SetPageLocation, SetViewportSize, SetPageVisibility } from '../app/mess
export default function (app: App): void {
let url: string, width: number, height: number
let navigationStart: number
let referrer = document.referrer
const sendSetPageLocation = app.safe(() => {
const { URL } = document
if (URL !== url) {
url = URL
app.send(SetPageLocation(url, document.referrer, navigationStart))
app.send(SetPageLocation(url, referrer, navigationStart))
navigationStart = 0
referrer = url
}
})