Skip to content

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

chore: added correct referrer policy

mildtomato3c3a16a64afe
diff --git a/web/static/scripts/telemetry.js b/web/static/scripts/telemetry.js
index 3e477644a89..52e67372301 100644
--- a/web/static/scripts/telemetry.js
+++ b/web/static/scripts/telemetry.js
@@ -1,18 +1,48 @@
function telemetry() {
- return fetch('https://app.supabase.io/api/telemetry/page', {
- mode: '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)
+ setTimeout(function () {
+ return fetch('https://app.supabase.io/api/telemetry/page', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ Accept: 'application/json',
+ },
+ referrerPolicy: 'no-referrer-when-downgrade',
+ body: JSON.stringify({
+ referrer: document.referrer,
+ title: document.title,
+ }),
+ }).catch((error) => {
+ console.error('Error at telemetry - post:', error)
+ })
+ }, 1000)
+}
+
+function pageState() {
+ ;(function () {
+ var pushState = history.pushState
+ var replaceState = history.replaceState
+
+ history.pushState = function () {
+ pushState.apply(history, arguments)
+ window.dispatchEvent(new Event('pushstate'))
+ window.dispatchEvent(new Event('locationchange'))
+ }
+
+ history.replaceState = function () {
+ replaceState.apply(history, arguments)
+ window.dispatchEvent(new Event('replacestate'))
+ window.dispatchEvent(new Event('locationchange'))
+ }
+
+ window.addEventListener('popstate', function () {
+ window.dispatchEvent(new Event('locationchange'))
+ })
+ })()
+
+ window.addEventListener('locationchange', function () {
+ telemetry()
})
}
+pageState()
telemetry()
diff --git a/www/lib/fetchWrapper.ts b/www/lib/fetchWrapper.ts
index 8fd0000cf1e..6e37b549b65 100644
--- a/www/lib/fetchWrapper.ts
+++ b/www/lib/fetchWrapper.ts
@@ -5,12 +5,12 @@ interface DataProps {
export const post = (url: string, data: DataProps, options = {}) => {
return fetch(url, {
- mode: 'cors', // 'cors' by default,
method: 'POST',
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
},
+ referrerPolicy: 'no-referrer-when-downgrade',
body: JSON.stringify(data),
...options,
}).catch((error) => {