[Statsig] Send ref source (#3531)
* [Statsig] Send ref source * Add is web check * Fix typeszio/stable
parent
c3f75330ed
commit
1390b1dc9e
|
@ -9,11 +9,20 @@ import {
|
||||||
} from 'statsig-react-native-expo'
|
} from 'statsig-react-native-expo'
|
||||||
|
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
|
import {isWeb} from '#/platform/detection'
|
||||||
import {IS_TESTFLIGHT} from 'lib/app-info'
|
import {IS_TESTFLIGHT} from 'lib/app-info'
|
||||||
import {useSession} from '../../state/session'
|
import {useSession} from '../../state/session'
|
||||||
import {LogEvents} from './events'
|
import {LogEvents} from './events'
|
||||||
import {Gate} from './gates'
|
import {Gate} from './gates'
|
||||||
|
|
||||||
|
let refSrc: string | undefined
|
||||||
|
let refUrl: string | undefined
|
||||||
|
if (isWeb && typeof window !== 'undefined') {
|
||||||
|
const params = new URLSearchParams(window.location.search)
|
||||||
|
refSrc = params.get('ref_src') ?? undefined
|
||||||
|
refUrl = params.get('ref_url') ?? undefined
|
||||||
|
}
|
||||||
|
|
||||||
export type {LogEvents}
|
export type {LogEvents}
|
||||||
|
|
||||||
const statsigOptions = {
|
const statsigOptions = {
|
||||||
|
@ -97,6 +106,8 @@ function toStatsigUser(did: string | undefined) {
|
||||||
userID,
|
userID,
|
||||||
platform: Platform.OS,
|
platform: Platform.OS,
|
||||||
custom: {
|
custom: {
|
||||||
|
refSrc,
|
||||||
|
refUrl,
|
||||||
// Need to specify here too for gating.
|
// Need to specify here too for gating.
|
||||||
platform: Platform.OS,
|
platform: Platform.OS,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue