diff options
author | Hailey <me@haileyok.com> | 2024-07-11 18:43:10 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-11 18:43:10 -0700 |
commit | 8b121af2e438ca77cc5f5b1715516107c18aff6f (patch) | |
tree | c7f1a28b63226c79e07aef4d2e88898358a62ec6 /src/lib/hooks/useIntentHandler.ts | |
parent | 83e8522e0a89be28b1733f4c50dbd4379d98d03b (diff) | |
download | voidsky-8b121af2e438ca77cc5f5b1715516107c18aff6f.tar.zst |
referrers for all platforms (#4514)
Diffstat (limited to 'src/lib/hooks/useIntentHandler.ts')
-rw-r--r-- | src/lib/hooks/useIntentHandler.ts | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/lib/hooks/useIntentHandler.ts b/src/lib/hooks/useIntentHandler.ts index 8741530b5..3235e1a6a 100644 --- a/src/lib/hooks/useIntentHandler.ts +++ b/src/lib/hooks/useIntentHandler.ts @@ -1,9 +1,12 @@ import React from 'react' import * as Linking from 'expo-linking' + +import {logEvent} from 'lib/statsig/statsig' import {isNative} from 'platform/detection' -import {useComposerControls} from 'state/shell' import {useSession} from 'state/session' +import {useComposerControls} from 'state/shell' import {useCloseAllActiveElements} from 'state/util' +import {Referrer} from '../../../modules/expo-bluesky-swiss-army' type IntentType = 'compose' @@ -15,6 +18,16 @@ export function useIntentHandler() { React.useEffect(() => { const handleIncomingURL = (url: string) => { + Referrer.getReferrerInfoAsync().then(info => { + if (info && info.hostname !== 'bsky.app') { + logEvent('deepLink:referrerReceived', { + to: url, + referrer: info?.referrer, + hostname: info?.hostname, + }) + } + }) + // We want to be able to support bluesky:// deeplinks. It's unnatural for someone to use a deeplink with three // slashes, like bluesky:///intent/follow. However, supporting just two slashes causes us to have to take care // of two cases when parsing the url. If we ensure there is a third slash, we can always ensure the first |