Remove metrika id from env
This commit is contained in:
@@ -41,9 +41,6 @@ steps:
|
|||||||
from_secret: ssh_private_key
|
from_secret: ssh_private_key
|
||||||
MONGODB_URI:
|
MONGODB_URI:
|
||||||
from_secret: MONGODB_URI
|
from_secret: MONGODB_URI
|
||||||
YA_METRIKA_ID:
|
|
||||||
from_secret: YA_METRIKA_ID
|
|
||||||
NODE_ENV: production
|
|
||||||
commands:
|
commands:
|
||||||
- git clone -b monorepo https://git.radner.ru/anatolykopyl/warframe-center.git
|
- git clone -b monorepo https://git.radner.ru/anatolykopyl/warframe-center.git
|
||||||
- cd warframe-center
|
- cd warframe-center
|
||||||
|
|||||||
@@ -1,2 +1 @@
|
|||||||
MONGODB_URI=
|
MONGODB_URI=
|
||||||
YA_METRIKA_ID=
|
|
||||||
|
|||||||
@@ -2,20 +2,18 @@ import Router from 'next/router'
|
|||||||
import React, { useCallback, useEffect } from 'react'
|
import React, { useCallback, useEffect } from 'react'
|
||||||
import ym, { YMInitializer } from 'react-yandex-metrika'
|
import ym, { YMInitializer } from 'react-yandex-metrika'
|
||||||
|
|
||||||
const enabled =
|
|
||||||
process.env.NODE_ENV === 'production' &&
|
|
||||||
process.env.YA_METRIKA_ID
|
|
||||||
|
|
||||||
const WithYandexMetrika = (props) => {
|
const WithYandexMetrika = (props) => {
|
||||||
const { children } = props
|
const { children } = props
|
||||||
|
|
||||||
|
const enabled = process.env.NODE_ENV !== 'development'
|
||||||
|
|
||||||
const hit = useCallback((url) => {
|
const hit = useCallback((url) => {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
ym('hit', url)
|
ym('hit', url)
|
||||||
} else {
|
} else {
|
||||||
console.log('%c[YandexMetrika](HIT)', 'color: orange', url)
|
console.log('%c[YandexMetrika](HIT)', 'color: orange', url)
|
||||||
}
|
}
|
||||||
}, [])
|
}, [enabled])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
hit(window.location.pathname + window.location.search)
|
hit(window.location.pathname + window.location.search)
|
||||||
@@ -26,7 +24,7 @@ const WithYandexMetrika = (props) => {
|
|||||||
<>
|
<>
|
||||||
{enabled && (
|
{enabled && (
|
||||||
<YMInitializer
|
<YMInitializer
|
||||||
accounts={[Number(process.env.YA_METRIKA_ID)]}
|
accounts={[87671663]}
|
||||||
options={{ webvisor: true, defer: true }}
|
options={{ webvisor: true, defer: true }}
|
||||||
version='2'
|
version='2'
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user