Skip to content

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

Revert "revert earlier pr"

Inian Parameshwarand686518f6f5c
diff --git a/vercel-local.json b/vercel-local.json
index 9afdef4d9bb..a1f26d1fde5 100644
--- a/vercel-local.json
+++ b/vercel-local.json
@@ -4,6 +4,10 @@
{ "source": "/", "destination": "http://localhost:3000/new" },
{ "source": "/beta", "destination": "http://localhost:3000/new/beta" },
{ "source": "/:name.:extension", "destination": "http://localhost:3005/:name.:extension" },
+ {
+ "source": "/:asset/:name.:extension",
+ "destination": "http://localhost:3005/:asset/:name.:extension"
+ },
{ "source": "/:match*", "destination": "http://localhost:3005/:match*/" }
],
"redirects": [
diff --git a/web/docusaurus.config.js b/web/docusaurus.config.js
index 8ba94d398de..a747d8731bb 100755
--- a/web/docusaurus.config.js
+++ b/web/docusaurus.config.js
@@ -47,9 +47,6 @@ module.exports = {
},
image: '/img/supabase-og-image.png', // used for meta tag, in particular og:image and twitter:image
metaImage: '/img/supabase-og-image.png',
- googleAnalytics: {
- trackingID: 'UA-155232740-1',
- },
navbar: {
// classNames: 'shadow--md',
// title: 'supabase',
@@ -244,6 +241,7 @@ module.exports = {
},
],
],
+ scripts: [{ src: '/scripts/telemetry.js' }],
// plugins: [
// // [
// // '@docusaurus/plugin-content-docs',
diff --git a/www/pages/_app.tsx b/www/pages/_app.tsx
index 6ac887c0430..890778ceeeb 100644
--- a/www/pages/_app.tsx
+++ b/www/pages/_app.tsx
@@ -1,6 +1,39 @@
import { AppProps } from 'next/app'
+import { useRouter } from 'next/router'
+import { useEffect } from 'react'
import '../styles/index.css'
+import { post } from './../lib/fetchWrapper'
export default function MyApp({ Component, pageProps }: AppProps) {
+ const router = useRouter()
+
+ function telemetry() {
+ return post(`https://app.supabase.io/api/telemetry/page`, {
+ referrer: document.referrer,
+ title: document.title,
+ })
+ }
+
+ useEffect(() => {
+ // `routeChangeComplete` won't run for the first page load unless the query string is
+ // hydrated later on, so here we log a page view if this is the first render and
+ // there's no query string
+ if (!router.asPath.includes('?')) {
+ telemetry()
+ }
+ }, [])
+
+ useEffect(() => {
+ function handleRouteChange() {
+ telemetry()
+ }
+
+ // Listen for page changes after a navigation or when the query changes
+ router.events.on('routeChangeComplete', handleRouteChange)
+ return () => {
+ router.events.off('routeChangeComplete', handleRouteChange)
+ }
+ }, [router.events])
+
return <Component {...pageProps} />
}
diff --git a/www/pages/_document.tsx b/www/pages/_document.tsx
index cef2c8476ad..4ae1cf1f573 100644
--- a/www/pages/_document.tsx
+++ b/www/pages/_document.tsx
@@ -11,19 +11,7 @@ export default class MyDocument extends Document {
render() {
return (
<Html lang="en" className="dark">
- <Head>
- <script
- dangerouslySetInnerHTML={{
- __html: `(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
- (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
- m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
- })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
-
- ga('create', 'UA-155232740-1', 'auto');
- ga('send', 'pageview');`,
- }}
- />
- </Head>
+ <Head></Head>
<body>
<Main />
<NextScript />