Merge branch 'bluesky-social:main' into zh
commit
b80594a554
|
@ -26,6 +26,8 @@ type StatsigUser = {
|
||||||
bundleDate: number
|
bundleDate: number
|
||||||
refSrc: string
|
refSrc: string
|
||||||
refUrl: string
|
refUrl: string
|
||||||
|
referrer: string
|
||||||
|
referrerHostname: string
|
||||||
appLanguage: string
|
appLanguage: string
|
||||||
contentLanguages: string[]
|
contentLanguages: string[]
|
||||||
}
|
}
|
||||||
|
@ -33,12 +35,29 @@ type StatsigUser = {
|
||||||
|
|
||||||
let refSrc = ''
|
let refSrc = ''
|
||||||
let refUrl = ''
|
let refUrl = ''
|
||||||
|
let referrer = ''
|
||||||
|
let referrerHostname = ''
|
||||||
if (isWeb && typeof window !== 'undefined') {
|
if (isWeb && typeof window !== 'undefined') {
|
||||||
const params = new URLSearchParams(window.location.search)
|
const params = new URLSearchParams(window.location.search)
|
||||||
refSrc = params.get('ref_src') ?? ''
|
refSrc = params.get('ref_src') ?? ''
|
||||||
refUrl = decodeURIComponent(params.get('ref_url') ?? '')
|
refUrl = decodeURIComponent(params.get('ref_url') ?? '')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
isWeb &&
|
||||||
|
typeof document !== 'undefined' &&
|
||||||
|
document != null &&
|
||||||
|
document.referrer
|
||||||
|
) {
|
||||||
|
try {
|
||||||
|
const url = new URL(document.referrer)
|
||||||
|
if (url.hostname !== 'bsky.app') {
|
||||||
|
referrer = document.referrer
|
||||||
|
referrerHostname = url.hostname
|
||||||
|
}
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
|
||||||
export type {LogEvents}
|
export type {LogEvents}
|
||||||
|
|
||||||
function createStatsigOptions(prefetchUsers: StatsigUser[]) {
|
function createStatsigOptions(prefetchUsers: StatsigUser[]) {
|
||||||
|
@ -198,6 +217,8 @@ function toStatsigUser(did: string | undefined): StatsigUser {
|
||||||
custom: {
|
custom: {
|
||||||
refSrc,
|
refSrc,
|
||||||
refUrl,
|
refUrl,
|
||||||
|
referrer,
|
||||||
|
referrerHostname,
|
||||||
platform: Platform.OS as 'ios' | 'android' | 'web',
|
platform: Platform.OS as 'ios' | 'android' | 'web',
|
||||||
bundleIdentifier: BUNDLE_IDENTIFIER,
|
bundleIdentifier: BUNDLE_IDENTIFIER,
|
||||||
bundleDate: BUNDLE_DATE,
|
bundleDate: BUNDLE_DATE,
|
||||||
|
|
Loading…
Reference in New Issue