Skip to content

добавлена гугл.аналитика. хм.. будет ли это работать с подключениями из скрипта Квантума? #92

Merged
AnnaCodit merged 1 commit intodevfrom
adding-google-analytics
Mar 26, 2026
Merged

Conversation

@AnnaCodit
Copy link
Copy Markdown
Owner

No description provided.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread js/analytics.js
Comment on lines +24 to +25
gtag('js', new Date());
gtag('config', google_analytics_id);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread js/analytics.js

// Дублируем в Google
if (typeof gtag === 'function') {
console.log('Отправили событие в Google Analytics', goal, params);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Этот оператор console.log полезен для отладки, но в производственной среде его следует сделать условным или удалить, чтобы избежать засорения консоли и потенциального раскрытия внутренних деталей.

Suggested change
console.log('Отправили событие в Google Analytics', goal, params);
if (process.env.NODE_ENV !== 'production') { console.log('Отправили событие в Google Analytics', goal, params); }

Comment thread js/analytics.js

// Дублируем в Google
if (typeof gtag === 'function') {
console.log('Отправили параметры пользователя в Google Analytics', params);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Аналогично, этот console.log следует сделать условным или удалить для производственной среды.

Suggested change
console.log('Отправили параметры пользователя в Google Analytics', params);
if (process.env.NODE_ENV !== 'production') { console.log('Отправили параметры пользователя в Google Analytics', params); }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant