Skip to content

🐞[Bug]: Duplicate Google Analytics & GTM initialization inflating tracking metrics #2515

Closed

Description

@bobby404-K

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Google Tag Manager / Google Analytics is loaded and initialized twice on every page load across the entire website. This results in duplicate pageview events, distorted bounce rates, and inaccurate traffic telemetry.

Root Cause:

  1. In docusaurus.config.ts (lines 106–109), Docusaurus Classic Preset already enables Google Analytics via:

    gtag: {
      trackingID: "G-W02Z2VJYCR",
      anonymizeIP: false,
    }

    This automatically injects @docusaurus/plugin-google-gtag and configures the tracking script.

  2. In the same config under scripts: [] (lines 51–57), the site also manually injects:

    • https://www.googletagmanager.com/gtag/js?id=G-W02Z2VJYCR
    • /gtag-init.js
  3. Furthermore, in static/gtag-init.js (line 9), debug_mode is passed as a string ("true" / "false") instead of a boolean (true / false).

Expected behavior

Google Analytics (gtag) should only be injected and initialized once via the Docusaurus Preset Classic configuration, avoiding redundant network requests and duplicate tracking calls.

What browsers are you seeing the problem on?

Chrome, Firefox, Safari, Microsoft Edge

Record

  • I have read the Contributing Guidelines
  • I want to work on this issue

Activity

  1. github-actions commented on Nov 11, 2026

    @github-actions

    Thanks for opening this issue! 🎉 We'll look into it as soon as possible, estimated time for response is 5–8 hrs.

    Don't raise PR unless assigned to you.

    In the meantime, please provide all necessary details and context to your issue — screenshots or videos of your changes help speed up the review and assignment. If you have questions, reach out to LinkedIn. Your contributions are highly appreciated!😊

    Note: I maintain the repo issue every day twice at 8:00 AM IST and 9:00 PM IST. If your issue goes stale for more than one day, you can tag and comment on this same issue by tagging @sanjay-kv.

    We are here to help you on this journey of open source. Consistent contributions are eligible for sponsorship 💰

    🎁 check our list of amazing people we sponsored so far: GitHub Sponsorship. ✨

    📚Resources which can help you know more about Github 👇🏻

    1. End to End GitHub Beginner Playlist: GitHub Playlist.

    2. Build your GitHub Profile: GitHub Profile Optimisation.

    3. GitHub Handbook for dummies: GitHub Blog for Beginners.

  2. github-actions commented on Nov 11, 2026

    @github-actions

    Thanks for opening this issue. To help maintainers review it faster, please add the missing details below:

    • Fill in the "Describe the bug" section.
    • Fill in the "Expected behavior" section.
  3. Khushbu677 commented on Nov 11, 2026

    @Khushbu677

    Hi , I would like to work on this issue. I have gone through the reported problem and understand that Google Analytics is being initialized through both the Docusaurus configuration and manually injected scripts. I would be happy to investigate and fix the duplicate initialization. Could you please assign this issue to me?

  4. github-actions commented on Nov 11, 2026

    @github-actions

    👤 Issue assigned to @bobby404-K.

  5. sanjay-kv commented on Nov 14, 2026

    @sanjay-kv
    Member

    @Khushbu677 there is couple of open issue available please check that this has been done by @bobby404-K

  6. added this to the Winter of recode milestone on Nov 14, 2026
  7. github-actions commented on Nov 14, 2026

    @github-actions

    ✅ This issue has been closed. Thank you for your contribution!

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

Metadata

Metadata

Assignees

Labels

level 110 pointsrecodethis is label for leaderboard

Type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions