Conversation
There was a problem hiding this comment.
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.
| googleTagManager: { | ||
| containerId: 'GTM-MVPNN2', | ||
| }, | ||
| gtag: { | ||
| trackingID: 'G-CVKKEY0D6B', | ||
| anonymizeIP: true, | ||
| }, |
There was a problem hiding this comment.
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.
| 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, | |
| }, |
Similar to: Couchbase-Ecosystem/cbl-ionic-docs#51