Try/catch URL parsing of referrer (#4511)
parent
d9066a6beb
commit
bdeac28d74
|
@ -43,12 +43,19 @@ if (isWeb && typeof window !== 'undefined') {
|
||||||
refUrl = decodeURIComponent(params.get('ref_url') ?? '')
|
refUrl = decodeURIComponent(params.get('ref_url') ?? '')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isWeb && typeof document !== 'undefined' && document != null) {
|
if (
|
||||||
|
isWeb &&
|
||||||
|
typeof document !== 'undefined' &&
|
||||||
|
document != null &&
|
||||||
|
document.referrer
|
||||||
|
) {
|
||||||
|
try {
|
||||||
const url = new URL(document.referrer)
|
const url = new URL(document.referrer)
|
||||||
if (url.hostname !== 'bsky.app') {
|
if (url.hostname !== 'bsky.app') {
|
||||||
referrer = document.referrer
|
referrer = document.referrer
|
||||||
referrerHostname = url.hostname
|
referrerHostname = url.hostname
|
||||||
}
|
}
|
||||||
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
export type {LogEvents}
|
export type {LogEvents}
|
||||||
|
|
Loading…
Reference in New Issue