feat: enhance analytics component with configurable Vercel and Speed Insights options
This commit is contained in:
parent
d4b385f5a2
commit
e298910b4b
@ -1,3 +1,4 @@
|
||||
import { websiteConfig } from '@/config/website';
|
||||
import DataFastAnalytics from './data-fast-analytics';
|
||||
import GoogleAnalytics from './google-analytics';
|
||||
import OpenPanelAnalytics from './open-panel-analytics';
|
||||
@ -43,11 +44,15 @@ export function Analytics() {
|
||||
|
||||
{/* vercel analytics */}
|
||||
{/* https://vercel.com/docs/analytics/quickstart */}
|
||||
<VercelAnalytics />
|
||||
{websiteConfig.analytics.enableVercelAnalytics && (
|
||||
<VercelAnalytics />
|
||||
)}
|
||||
|
||||
{/* speed insights */}
|
||||
{/* https://vercel.com/docs/speed-insights/quickstart */}
|
||||
<SpeedInsights />
|
||||
{websiteConfig.analytics.enableSpeedInsights && (
|
||||
<SpeedInsights />
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
@ -29,6 +29,10 @@ export const websiteConfig: WebsiteConfig = {
|
||||
youtube: 'https://www.youtube.com/@MkSaaS',
|
||||
},
|
||||
},
|
||||
analytics: {
|
||||
enableVercelAnalytics: true,
|
||||
enableSpeedInsights: true,
|
||||
},
|
||||
i18n: {
|
||||
defaultLocale: 'en',
|
||||
locales: {
|
||||
|
13
src/types/index.d.ts
vendored
13
src/types/index.d.ts
vendored
@ -5,6 +5,7 @@ import type { ReactNode } from 'react';
|
||||
*/
|
||||
export type WebsiteConfig = {
|
||||
metadata: MetadataConfig;
|
||||
analytics: AnalyticsConfig;
|
||||
i18n: I18nConfig;
|
||||
blog: BlogConfig;
|
||||
mail: MailConfig;
|
||||
@ -55,12 +56,20 @@ export interface SocialConfig {
|
||||
tiktok?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Analytics configuration
|
||||
*/
|
||||
export interface AnalyticsConfig {
|
||||
enableVercelAnalytics?: boolean; // Whether to enable vercel analytics
|
||||
enableSpeedInsights?: boolean; // Whether to enable speed insights
|
||||
}
|
||||
|
||||
/**
|
||||
* I18n configuration
|
||||
*/
|
||||
export interface I18nConfig {
|
||||
defaultLocale: string;
|
||||
locales: Record<string, { flag?: string; name: string }>;
|
||||
defaultLocale: string; // The default locale of the website
|
||||
locales: Record<string, { flag?: string; name: string }>; // The locales of the website
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user