mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
add analytics to 5chan.app
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
"@types/react": "18.2.25",
|
||||
"@types/react-dom": "18.2.10",
|
||||
"@use-gesture/react": "10.3.1",
|
||||
"@vercel/analytics": "^1.6.1",
|
||||
"cross-env": "7.0.3",
|
||||
"electron-context-menu": "3.3.0",
|
||||
"electron-is-dev": "2.0.0",
|
||||
|
||||
@@ -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>,
|
||||
);
|
||||
|
||||
@@ -5145,6 +5145,11 @@
|
||||
dependencies:
|
||||
"@use-gesture/core" "10.3.1"
|
||||
|
||||
"@vercel/analytics@^1.6.1":
|
||||
version "1.6.1"
|
||||
resolved "https://registry.yarnpkg.com/@vercel/analytics/-/analytics-1.6.1.tgz#b4e16daf445cf6cd365a91e43d86e9e5b3428ddc"
|
||||
integrity sha512-oH9He/bEM+6oKlv3chWuOOcp8Y6fo6/PSro8hEkgCW3pu9/OiCXiUpRUogDh3Fs3LH2sosDrx8CxeOLBEE+afg==
|
||||
|
||||
"@vitejs/plugin-react@4.3.4":
|
||||
version "4.3.4"
|
||||
resolved "https://registry.yarnpkg.com/@vitejs/plugin-react/-/plugin-react-4.3.4.tgz#c64be10b54c4640135a5b28a2432330e88ad7c20"
|
||||
|
||||
Reference in New Issue
Block a user