@@ -7,6 +7,7 @@ import { ENV, MODE, VARS, isCloud } from '$lib/system';
77import { AppwriteException } from '@appwrite.io/console' ;
88import { browser } from '$app/environment' ;
99import { getReferrerAndUtmSource , getTrackedQueryParams } from '$lib/helpers/utm' ;
10+ import { ProfileMode } from '$lib/profiles/index.svelte' ;
1011
1112function plausible ( domain : string ) : AnalyticsPlugin {
1213 if ( ! browser ) return { name : 'analytics-plugin-plausible' } ;
@@ -42,13 +43,24 @@ function plausible(domain: string): AnalyticsPlugin {
4243
4344const PLAUSIBLE_DOMAINS = {
4445 CLOUD : 'cloud.appwrite.io' ,
45- GLOBAL : 'console.appwrite ' ,
46+ STUDIO : 'studio.imagine.dev ' ,
4647 SELF_HOSTED : 'self-hosted.appwrite'
48+ /*GLOBAL: 'console.appwrite',*/
4749} ;
4850
51+ function getPlausibleDomain ( ) : string {
52+ if ( VARS . CONSOLE_PROFILE === ProfileMode . STUDIO ) {
53+ return PLAUSIBLE_DOMAINS . STUDIO ;
54+ } else {
55+ return isCloud
56+ ? PLAUSIBLE_DOMAINS . CLOUD
57+ : PLAUSIBLE_DOMAINS . SELF_HOSTED ;
58+ }
59+ }
60+
4961const analytics = Analytics ( {
5062 app : 'appwrite' ,
51- plugins : [ plausible ( isCloud ? PLAUSIBLE_DOMAINS . CLOUD : PLAUSIBLE_DOMAINS . SELF_HOSTED ) ]
63+ plugins : [ plausible ( getPlausibleDomain ( ) ) ]
5264} ) ;
5365
5466export function trackEvent ( name : string , data : object = null ) : void {
0 commit comments