Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

add `document.referrer` to statsig custom (#4509)

* add referrer to statsig custom

dont include referrer if hostname is bsky.app

save

add `document.referrer` to statsig custom

* add a hostname field

* account for ssr

* account for ssr

authored by

Hailey and committed by
GitHub
d9066a6b d20c59e1

+14
+14
src/lib/statsig/statsig.tsx
··· 26 26 bundleDate: number 27 27 refSrc: string 28 28 refUrl: string 29 + referrer: string 30 + referrerHostname: string 29 31 appLanguage: string 30 32 contentLanguages: string[] 31 33 } ··· 33 35 34 36 let refSrc = '' 35 37 let refUrl = '' 38 + let referrer = '' 39 + let referrerHostname = '' 36 40 if (isWeb && typeof window !== 'undefined') { 37 41 const params = new URLSearchParams(window.location.search) 38 42 refSrc = params.get('ref_src') ?? '' 39 43 refUrl = decodeURIComponent(params.get('ref_url') ?? '') 44 + } 45 + 46 + if (isWeb && typeof document !== 'undefined' && document != null) { 47 + const url = new URL(document.referrer) 48 + if (url.hostname !== 'bsky.app') { 49 + referrer = document.referrer 50 + referrerHostname = url.hostname 51 + } 40 52 } 41 53 42 54 export type {LogEvents} ··· 198 210 custom: { 199 211 refSrc, 200 212 refUrl, 213 + referrer, 214 + referrerHostname, 201 215 platform: Platform.OS as 'ios' | 'android' | 'web', 202 216 bundleIdentifier: BUNDLE_IDENTIFIER, 203 217 bundleDate: BUNDLE_DATE,