posthog added
This commit is contained in:
parent
7b94785a30
commit
418cc3a043
|
|
@ -49,10 +49,11 @@
|
|||
"ngx-image-cropper": "^8.0.0",
|
||||
"ngx-mask": "^18.0.0",
|
||||
"ngx-quill": "^26.0.5",
|
||||
"quill": "2.0.2",
|
||||
"ngx-sharebuttons": "^15.0.3",
|
||||
"ngx-stripe": "^18.1.0",
|
||||
"on-change": "^5.0.1",
|
||||
"posthog-js": "^1.259.0",
|
||||
"quill": "2.0.2",
|
||||
"rxjs": "~7.8.1",
|
||||
"tslib": "^2.6.3",
|
||||
"urlcat": "^3.1.0",
|
||||
|
|
@ -78,4 +79,4 @@
|
|||
"tailwindcss": "^3.4.4",
|
||||
"typescript": "~5.4.5"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import { AuthInterceptor } from './interceptors/auth.interceptor';
|
|||
import { LoadingInterceptor } from './interceptors/loading.interceptor';
|
||||
import { TimeoutInterceptor } from './interceptors/timeout.interceptor';
|
||||
import { GlobalErrorHandler } from './services/globalErrorHandler';
|
||||
import { POSTHOG_INIT_PROVIDER } from './services/posthog.factory';
|
||||
import { SelectOptionsService } from './services/select-options.service';
|
||||
import { createLogger } from './utils/utils';
|
||||
// provideClientHydration()
|
||||
|
|
@ -67,6 +68,7 @@ export const appConfig: ApplicationConfig = {
|
|||
anchorScrolling: 'enabled',
|
||||
}),
|
||||
),
|
||||
...(environment.production ? [POSTHOG_INIT_PROVIDER] : []),
|
||||
provideAnimations(),
|
||||
provideNgxStripe('pk_test_IlpbVQhxAXZypLgnCHOCqlj8'),
|
||||
provideQuillConfig({
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
// posthog.factory.ts
|
||||
import { isPlatformBrowser } from '@angular/common';
|
||||
import { APP_INITIALIZER, FactoryProvider, PLATFORM_ID, inject } from '@angular/core';
|
||||
import { environment } from '../../environments/environment';
|
||||
|
||||
export function initPosthog() {
|
||||
const platformId = inject(PLATFORM_ID);
|
||||
|
||||
// Nur Browser + nur Production
|
||||
if (!isPlatformBrowser(platformId) || !environment.production) return () => {};
|
||||
|
||||
return async () => {
|
||||
// Dynamisch laden -> eigener Chunk, wird in Dev nie gezogen
|
||||
const { default: posthog } = await import('posthog-js');
|
||||
posthog.init(environment.POSTHOG_KEY, {
|
||||
api_host: environment.POSTHOG_HOST,
|
||||
capture_pageview: 'history_change',
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export const POSTHOG_INIT_PROVIDER: FactoryProvider = {
|
||||
provide: APP_INITIALIZER,
|
||||
useFactory: initPosthog,
|
||||
multi: true,
|
||||
};
|
||||
|
|
@ -16,4 +16,7 @@ export const environment_base = {
|
|||
appId: '1:1065122571067:web:1124571ab67bc0f5240d1e',
|
||||
measurementId: 'G-MHVDK1KSWV',
|
||||
},
|
||||
POSTHOG_KEY: '',
|
||||
POSTHOG_HOST: '',
|
||||
production: false,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
import { environment_base } from './environment.base';
|
||||
|
||||
export const environment = environment_base;
|
||||
|
||||
environment.production = true;
|
||||
environment.apiBaseUrl = 'https://api.bizmatch.net';
|
||||
environment.mailinfoUrl = 'https://www.bizmatch.net';
|
||||
environment.imageBaseUrl = 'https://www.bizmatch.net';
|
||||
|
||||
environment.POSTHOG_KEY = 'phc_eUIcIq0UPVzEDtZLy78klKhGudyagBz3goDlKx8SQFe';
|
||||
environment.POSTHOG_HOST = 'https://eu.i.posthog.com';
|
||||
|
|
|
|||
Loading…
Reference in New Issue