mirror of
https://github.com/supabase/supabase.git
synced 2026-10-11 04:15:04 +03:00
Merge pull request #8117 from supabase/fix/telemtry-signup
fix: telemetry sign up
This commit is contained in:
2 files changed
+18
-3
No files matched your search
@@ -18,7 +18,7 @@ const Landing = () => {
|
||||
provider: 'github',
|
||||
},
|
||||
{
|
||||
redirectTo: process.env.NEXT_PUBLIC_SITE_URL,
|
||||
redirectTo: `${process.env.NEXT_PUBLIC_SITE_URL}?auth=true`,
|
||||
}
|
||||
)
|
||||
if (error) throw error
|
||||
|
||||
@@ -12,6 +12,8 @@ const PageTelemetry: FC = ({ children }) => {
|
||||
const { ui } = useStore()
|
||||
const { profile } = ui
|
||||
|
||||
const isAuth = router.asPath && router.asPath.includes('auth=true')
|
||||
|
||||
useEffect(() => {
|
||||
function handleRouteChange() {
|
||||
handlePageTelemetry(profile)
|
||||
@@ -26,8 +28,20 @@ const PageTelemetry: FC = ({ children }) => {
|
||||
useEffect(() => {
|
||||
/**
|
||||
* Send page telemetry on first page load
|
||||
* if there asPath is defined, then this isn't needed
|
||||
*/
|
||||
handlePageTelemetry(profile)
|
||||
if (router.route === '/' && !router.asPath) {
|
||||
handlePageTelemetry(profile)
|
||||
}
|
||||
/**
|
||||
* remove auth param from callback url
|
||||
* to do: this causes an issue with sending two page views !
|
||||
*
|
||||
* author @mildtomato
|
||||
*/
|
||||
if (isAuth) {
|
||||
router.replace('/?auth=true', '/')
|
||||
}
|
||||
}, [])
|
||||
|
||||
const handlePageTelemetry = (profile?: User) => {
|
||||
@@ -41,7 +55,8 @@ const PageTelemetry: FC = ({ children }) => {
|
||||
* When user is logging in for first time, callback url will contain param `signup=true`
|
||||
* If true, we will exclude the referrer, which will likely be `github.com` (or any other provider used in future)
|
||||
*/
|
||||
if (router.asPath && router.asPath.includes('signup=true')) {
|
||||
|
||||
if (isAuth) {
|
||||
referrer = undefined
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user