The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore: remove google analytics and tracking cookies
mildtomatoe3ea2768af6c
diff --git a/web/docusaurus.config.js b/web/docusaurus.config.jsindex beec065a5ad..1d7d82b5685 100755--- a/web/docusaurus.config.js+++ b/web/docusaurus.config.js@@ -244,6 +244,7 @@ module.exports = {},],],+ scripts: [{ src: '/scripts/telemetry.js' }],// plugins: [// // [// // '@docusaurus/plugin-content-docs',diff --git a/web/static/scripts/telemetry.js b/web/static/scripts/telemetry.jsnew file mode 100644index 00000000000..852a55f680e--- /dev/null+++ b/web/static/scripts/telemetry.js@@ -0,0 +1,18 @@+function telemetry() {+ return fetch('https://app.supabase.io/api/telemetry/page', {+ mode: 'no-cors', // 'cors' by default,+ method: 'POST',+ headers: {+ 'Content-Type': 'application/json',+ Accept: 'application/json',+ },+ body: JSON.stringify({+ referrer: document.referrer,+ title: document.title,+ }),+ }).catch((error) => {+ console.error('Error at telemetry - post:', error)+ })+}++telemetry()diff --git a/www/lib/fetchWrapper.ts b/www/lib/fetchWrapper.tsnew file mode 100644index 00000000000..763c9d4c50b--- /dev/null+++ b/www/lib/fetchWrapper.ts@@ -0,0 +1,19 @@+interface DataProps {+ referrer?: string+ title: string+}++export const post = (url: string, data: DataProps, options = {}) => {+ return fetch(url, {+ mode: 'no-cors', // 'cors' by default,+ method: 'POST',+ headers: {+ 'Content-Type': 'application/json',+ Accept: 'application/json',+ },+ body: JSON.stringify(data),+ ...options,+ }).catch((error) => {+ console.error('Error at fetchWrapper - post:', error)+ })+}diff --git a/www/pages/_app.tsx b/www/pages/_app.tsxindex 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.tsxindex 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 />