diff --git a/.env.example b/.env.example index 06149b167..e9457b89f 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,5 @@ VITE_APPWRITE_ENDPOINT= +VITE_APPWRITE_GROWTH_ENDPOINT= VITE_GA_PROJECT= VITE_SENTRY_DSN= VITE_CONSOLE_MODE=self-hosted \ No newline at end of file diff --git a/src/lib/actions/analytics.ts b/src/lib/actions/analytics.ts index d169790ac..a57000024 100644 --- a/src/lib/actions/analytics.ts +++ b/src/lib/actions/analytics.ts @@ -3,7 +3,7 @@ import googleAnalytics from '@analytics/google-analytics'; import { get } from 'svelte/store'; import { page } from '$app/stores'; import { user } from '$lib/stores/user'; -import { Mode } from '$lib/constants'; +import { growthEndpoint, Mode } from '$lib/constants'; const analytics = Analytics({ app: 'appwrite', @@ -40,7 +40,7 @@ function sendEventToGrowth(event: string, path: string, data: object = null): vo email = userStore.email; name = userStore.name; } - fetch('https://growth.appwrite.io/v1/analytics', { + fetch(`${growthEndpoint}/analytics`, { method: 'POST', headers: { 'Content-Type': 'application/json' diff --git a/src/lib/constants.ts b/src/lib/constants.ts index 74b8860e8..428ae6392 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -7,6 +7,8 @@ export enum Mode { SELF_HOSTED = 'self-hosted' } +export const growthEndpoint = import.meta.env.VITE_APPWRITE_GROWTH_ENDPOINT; + export enum Dependencies { ORGANIZATION = 'dependency:organization', PROJECT = 'dependency:project', diff --git a/src/lib/stores/app.ts b/src/lib/stores/app.ts index 555d36415..f3b03e36b 100644 --- a/src/lib/stores/app.ts +++ b/src/lib/stores/app.ts @@ -1,4 +1,5 @@ import { browser } from '$app/environment'; +import { growthEndpoint } from '$lib/constants'; import { writable } from 'svelte/store'; export type AppStore = { @@ -59,7 +60,7 @@ function createFeedbackStore() { email?: string, value?: number ) => { - const response = await fetch('https://growth.appwrite.io/v1/feedback', { + const response = await fetch(`${growthEndpoint}/feedback`, { method: 'POST', headers: { 'Content-Type': 'application/json'