Skip to content

Add google analytics#11

Merged
azaddhirajkumar merged 1 commit intomainfrom
Add-google-analytics
Apr 15, 2026
Merged

Add google analytics#11
azaddhirajkumar merged 1 commit intomainfrom
Add-google-analytics

Conversation

@azaddhirajkumar
Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown

@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 adds Google Tag Manager and Google Analytics (gtag) configurations to the Docusaurus site. The reviewer pointed out that enabling both tracking methods simultaneously could result in duplicate event tracking and suggested using environment variables instead of hardcoded IDs to improve environment-specific configuration.

Comment thread docusaurus.config.js
Comment on lines +67 to +73
googleTagManager: {
containerId: 'GTM-MVPNN2',
},
gtag: {
trackingID: 'G-CVKKEY0D6B',
anonymizeIP: true,
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Configuring both googleTagManager and gtag simultaneously can lead to duplicate event tracking and inflated analytics metrics, as both plugins may trigger page view events. It is recommended to use only one of these methods. If Google Tag Manager is used to manage your tracking tags, the gtag configuration is typically redundant.

Additionally, hardcoding tracking IDs directly in the configuration makes it difficult to manage different environments (e.g., production vs. staging). Since dotenv is already a dependency in this project, consider using environment variables for these IDs.

Suggested change
googleTagManager: {
containerId: 'GTM-MVPNN2',
},
gtag: {
trackingID: 'G-CVKKEY0D6B',
anonymizeIP: true,
},
googleTagManager: {
containerId: process.env.GTM_CONTAINER_ID || 'GTM-MVPNN2',
},
gtag: {
trackingID: process.env.GTAG_TRACKING_ID || 'G-CVKKEY0D6B',
anonymizeIP: true,
},

@azaddhirajkumar azaddhirajkumar merged commit e190829 into main Apr 15, 2026
4 checks passed
@azaddhirajkumar azaddhirajkumar deleted the Add-google-analytics branch April 15, 2026 11:06
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.

2 participants