fix(#1791): Disable plausible init when analytics url is empty
This commit is contained in:
@@ -5,20 +5,23 @@ import { env } from './env';
|
||||
export let plausible: ReturnType<typeof PlausibleInstance> | undefined;
|
||||
|
||||
export const initAnalytics = async (): Promise<void> => {
|
||||
if (browser && !plausible) {
|
||||
if (!env.analyticsUrl || !browser || plausible) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const { default: Plausible } = await import('plausible-tracker');
|
||||
plausible = Plausible({
|
||||
// All tracked stats are public and available at https://p.mermaid.live/mermaid.live
|
||||
apiHost: env.analyticsUrl,
|
||||
domain: env.domain,
|
||||
hashMode: false
|
||||
hashMode: false,
|
||||
trackLocalhost: true
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.info('Analytics blocked ;)');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const countLines = (code: string): number => {
|
||||
|
||||
Reference in New Issue
Block a user