Skip to content

Integrate Google Analytics Tracking #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks
bhouston opened this issue Mar 7, 2025 · 0 comments · Fixed by #19
Closed
3 tasks

Integrate Google Analytics Tracking #17

bhouston opened this issue Mar 7, 2025 · 0 comments · Fixed by #19

Comments

@bhouston
Copy link
Member

bhouston commented Mar 7, 2025

Integrate Google Analytics Tracking

Description

We need to integrate Google Analytics into our Docusaurus site to track user interactions and page views.

Tracking Code

  • Google Analytics Measurement ID: G-4G4NJBHVNF

Implementation Tasks

  • Configure Google Analytics in docusaurus.config.ts using the provided tracking ID
  • Ensure tracking only happens in production environments
  • Test that analytics events are being properly sent

Implementation Details

Docusaurus has built-in support for Google Analytics via the @docusaurus/preset-classic that's already in use. The integration requires adding the gtag configuration to the themeConfig section:

themeConfig: {
  // ... existing config
  gtag: {
    trackingID: 'G-4G4NJBHVNF',
    anonymizeIP: true, // Optional: comply with GDPR
  },
}

Additional Considerations

  • Consider adding a cookie consent banner if the site will be accessed by users from regions with strict privacy laws (like EU/GDPR)
  • Ensure that analytics are only loaded in production environments
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 a pull request may close this issue.

1 participant