Conversation
…из скрипта Квантума?
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d5b0a2132d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| gtag('js', new Date()); | ||
| gtag('config', google_analytics_id); |
There was a problem hiding this comment.
Prevent repeated GA config calls on re-initialization
This block always executes gtag('config', google_analytics_id) whenever analytics.js is evaluated, so in contexts where the script is injected more than once (for example widget/script reconnections), GA4 will be reconfigured repeatedly and emit extra automatic page_view hits, inflating analytics totals. The Yandex bootstrap has a duplicate-load guard, but the GA bootstrap currently does not.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Code Review
This pull request integrates Google Analytics 4 into the existing analytics script. It adds initialization logic for GA4 and updates the analytics_reach_goal and analytics_set_visit_params functions to send data to both Yandex.Metrika and Google Analytics. Feedback was provided to wrap debug console.log statements in environment checks to prevent log pollution in production.
|
|
||
| // Дублируем в Google | ||
| if (typeof gtag === 'function') { | ||
| console.log('Отправили событие в Google Analytics', goal, params); |
There was a problem hiding this comment.
Этот оператор console.log полезен для отладки, но в производственной среде его следует сделать условным или удалить, чтобы избежать засорения консоли и потенциального раскрытия внутренних деталей.
| console.log('Отправили событие в Google Analytics', goal, params); | |
| if (process.env.NODE_ENV !== 'production') { console.log('Отправили событие в Google Analytics', goal, params); } |
|
|
||
| // Дублируем в Google | ||
| if (typeof gtag === 'function') { | ||
| console.log('Отправили параметры пользователя в Google Analytics', params); |
There was a problem hiding this comment.
Аналогично, этот console.log следует сделать условным или удалить для производственной среды.
| console.log('Отправили параметры пользователя в Google Analytics', params); | |
| if (process.env.NODE_ENV !== 'production') { console.log('Отправили параметры пользователя в Google Analytics', params); } |
No description provided.