add analytics to 5chan.app

This commit is contained in:
plebeius
2026-01-22 17:28:22 +01:00
parent 00b037cf97
commit 2e8481b28b
3 changed files with 13 additions and 0 deletions
+7
View File
@@ -7,12 +7,19 @@ import './lib/init-translations';
import './index.css';
import './themes.css';
import { App as CapacitorApp } from '@capacitor/app';
import { Analytics } from '@vercel/analytics/react';
// Only enable analytics on 5chan.app (Vercel deployment)
// Exclude Electron (file:// or localhost), Capacitor/APK (capacitor:// or localhost), and IPFS (ipfs:// or different domain)
const isVercelDeployment =
typeof window !== 'undefined' && (window.location.hostname === '5chan.app' || window.location.hostname === 'www.5chan.app') && !window.isElectron;
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
root.render(
<React.StrictMode>
<Router>
<App />
{isVercelDeployment && <Analytics />}
</Router>
</React.StrictMode>,
);