Switch ya metrika packages
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2022-07-05 09:50:16 +03:00
parent ad10f35e19
commit a77fefc251
4 changed files with 13179 additions and 593 deletions

View File

@@ -1,5 +1,4 @@
import Head from 'next/head'
import { YMInitializer } from 'react-yandex-metrika'
import Footer from './Footer'
@@ -9,11 +8,6 @@ export default function Layout ({ children }) {
<Head>
<title>Warframe Center</title>
<link rel='icon' href='/favicon.ico' />
<YMInitializer
accounts={[Number(process.env.YA_METRIKA_ID)]}
options={{ webvisor: true, defer: true }}
version='2'
/>
</Head>
<main>{children}</main>
<Footer />

View File

@@ -14,10 +14,10 @@
"next": "latest",
"next-compose-plugins": "^2.2.1",
"next-i18next": "^11.0.0",
"next-ym": "^2.3.5",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-moment": "^1.1.1",
"react-yandex-metrika": "^2.6.0",
"reset-css": "^5.0.1",
"sass": "^1.49.9",
"shared-stuff": "file:../shared-stuff",

View File

@@ -1,8 +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 withYM from 'next-ym'
import Router from 'next/router'
import 'reset-css'
import '../styles/global.scss'
@@ -15,15 +15,6 @@ 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 (
<ThemeProvider theme={theme}>
<CssBaseline />
@@ -34,4 +25,4 @@ function App ({ Component, pageProps }) {
)
}
export default appWithTranslation(App)
export default withYM(process.env.YA_METRIKA_ID, Router)(appWithTranslation(App))