Remove metrika id from env

This commit is contained in:
2022-07-05 14:49:12 +03:00
parent a40390a30e
commit efb1cba216
3 changed files with 4 additions and 10 deletions

View File

@@ -41,9 +41,6 @@ steps:
from_secret: ssh_private_key
MONGODB_URI:
from_secret: MONGODB_URI
YA_METRIKA_ID:
from_secret: YA_METRIKA_ID
NODE_ENV: production
commands:
- git clone -b monorepo https://git.radner.ru/anatolykopyl/warframe-center.git
- cd warframe-center

View File

@@ -1,2 +1 @@
MONGODB_URI=
YA_METRIKA_ID=

View File

@@ -2,20 +2,18 @@ import Router from 'next/router'
import React, { useCallback, useEffect } from 'react'
import ym, { YMInitializer } from 'react-yandex-metrika'
const enabled =
process.env.NODE_ENV === 'production' &&
process.env.YA_METRIKA_ID
const WithYandexMetrika = (props) => {
const { children } = props
const enabled = process.env.NODE_ENV !== 'development'
const hit = useCallback((url) => {
if (enabled) {
ym('hit', url)
} else {
console.log('%c[YandexMetrika](HIT)', 'color: orange', url)
}
}, [])
}, [enabled])
useEffect(() => {
hit(window.location.pathname + window.location.search)
@@ -26,7 +24,7 @@ const WithYandexMetrika = (props) => {
<>
{enabled && (
<YMInitializer
accounts={[Number(process.env.YA_METRIKA_ID)]}
accounts={[87671663]}
options={{ webvisor: true, defer: true }}
version='2'
/>