diff --git a/next.config.js b/next.config.js index 2fe5e5325..fb78be929 100644 --- a/next.config.js +++ b/next.config.js @@ -59,6 +59,10 @@ module.exports = { source: '/recentes/rss', destination: '/api/v1/contents/rss', }, + { + source: '/api/v1/analytics', + destination: `${process.env.UMAMI_ENDPOINT}/api/send`, + }, ]; }, headers() { diff --git a/pages/_app.public.js b/pages/_app.public.js index 0e825634a..254ddf2c2 100644 --- a/pages/_app.public.js +++ b/pages/_app.public.js @@ -1,9 +1,8 @@ -import { Analytics } from '@vercel/analytics/react'; import { RevalidateProvider } from 'next-swr'; import { SWRConfig } from 'swr'; import { ThemeProvider, Turnstile } from '@/TabNewsUI'; -import { DefaultHead, UserProvider } from 'pages/interface'; +import { Analytics, DefaultHead, UserProvider } from 'pages/interface'; async function SWRFetcher(resource, init) { const response = await fetch(resource, init); @@ -30,15 +29,7 @@ function MyApp({ Component, pageProps }) { - { - const { pathname } = new URL(event.url); - if (['/', '/publicar'].includes(pathname)) { - return null; - } - return event; - }} - /> + ); diff --git a/pages/interface/components/Analytics/index.js b/pages/interface/components/Analytics/index.js new file mode 100644 index 000000000..302fdb3c6 --- /dev/null +++ b/pages/interface/components/Analytics/index.js @@ -0,0 +1,26 @@ +import { Analytics as VercelAnalytics } from '@vercel/analytics/react'; +import Script from 'next/script'; + +export default function Analytics() { + return ( + <> +