diff --git a/app/.env.local.example b/app/.env.local.example
index 9dead41..32e425e 100644
--- a/app/.env.local.example
+++ b/app/.env.local.example
@@ -1 +1,2 @@
-MONGODB_URI=
\ No newline at end of file
+MONGODB_URI=
+YA_METRIKA_ID=
diff --git a/app/components/layout.js b/app/components/layout.js
index d7ddea9..a636b98 100644
--- a/app/components/layout.js
+++ b/app/components/layout.js
@@ -9,7 +9,11 @@ export default function Layout ({ children }) {
Warframe Center
-
+
{children}
diff --git a/app/pages/_app.js b/app/pages/_app.js
index de23c25..86ae5d3 100644
--- a/app/pages/_app.js
+++ b/app/pages/_app.js
@@ -1,6 +1,8 @@
import { CssBaseline } from '@mui/material'
import { createTheme, ThemeProvider } from '@mui/material/styles'
import { appWithTranslation } from 'next-i18next'
+import { useEffect } from 'react'
+import ym from 'react-yandex-metrika'
import 'reset-css'
import '../styles/global.scss'
@@ -13,6 +15,15 @@ function App ({ Component, pageProps }) {
}
})
+ useEffect(() => {
+ if (typeof window !== 'undefined' && process.env.NODE_ENV === 'production') {
+ const url = window.location.pathname + window.location.search
+ ym('hit', url)
+ } else {
+ console.log('Not in production, not sending Yandex Metrika hit')
+ }
+ }, [])
+
return (
diff --git a/app/pages/home/index.js b/app/pages/home/index.js
index 1972cb1..5b2c0af 100644
--- a/app/pages/home/index.js
+++ b/app/pages/home/index.js
@@ -1,5 +1,4 @@
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
-import { Component } from 'react'
import { models } from 'shared-stuff'
import dbConnect from '../../lib/dbConnect'
@@ -7,22 +6,15 @@ import dbConnect from '../../lib/dbConnect'
import Hero from './Hero'
import Table from './Table'
-export default class Home extends Component {
- constructor ({ scanResults }) {
- super()
- this.scanResults = scanResults
- }
-
- render () {
- return (
- <>
-
-
- >
- )
- }
+export default function Home ({ scanResults }) {
+ return (
+ <>
+
+
+ >
+ )
}
export async function getServerSideProps ({ locale }) {