Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix: telemetry sign up

Jonathan Summers-Muir6f12b852a1bd
diff --git a/studio/components/interfaces/Home/Landing.tsx b/studio/components/interfaces/Home/Landing.tsx
index d383907d846..d0cee301e51 100644
--- a/studio/components/interfaces/Home/Landing.tsx
+++ b/studio/components/interfaces/Home/Landing.tsx
@@ -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
diff --git a/studio/components/ui/PageTelemetry.tsx b/studio/components/ui/PageTelemetry.tsx
index 10532969edf..800f5ecd69e 100644
--- a/studio/components/ui/PageTelemetry.tsx
+++ b/studio/components/ui/PageTelemetry.tsx
@@ -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
}