Skip to content

Conversation

@dleffel
Copy link
Collaborator

@dleffel dleffel commented Nov 5, 2025

Summary

This PR simplifies the Google Analytics implementation by removing Consent Mode v2 and cookieless tracking features in favor of Google's standard out-of-the-box gtag.js pattern.

Changes

  • ✅ Remove Consent Mode v2 implementation
  • ✅ Remove URL passthrough feature
  • ✅ Remove cookieless tracking functionality
  • ✅ Switch to Google's standard gtag.js loading pattern
  • ✅ Maintain consent-based loading (scripts only load after user consent)
  • ✅ Simplify type definitions

Rationale

The standard out-of-the-box implementation is more stable and complies with consent requirements. The cookieless tracking wasn't working properly, and the effort to get it working isn't worth the added complexity.

Benefits:

  • More stable: Using Google's recommended implementation pattern
  • Simpler: Reduced code complexity from 153 lines to 68 lines
  • Compliant: Still respects user consent before loading any tracking scripts
  • Maintainable: Easier to understand and maintain

Technical Details

The new implementation:

  1. Initializes early (Google's recommended pattern)
  2. Uses two separate Script tags following Google's official documentation
  3. Only loads scripts after user explicitly gives consent
  4. Removes all consent mode API calls and URL passthrough configuration

Important

Simplifies Google Analytics by removing complex features and adopting standard gtag.js pattern in google-analytics-provider.tsx.

  • Behavior:
    • Remove Consent Mode v2 and cookieless tracking from google-analytics-provider.tsx.
    • Switch to standard gtag.js loading pattern, loading scripts only after user consent.
  • Code Simplification:
    • Reduce code complexity from 153 lines to 68 lines in google-analytics-provider.tsx.
    • Simplify type definitions for dataLayer and gtag in google-analytics-provider.tsx.
  • Rationale:
    • Standard implementation is more stable and compliant with consent requirements.

This description was created by Ellipsis for ab22b2d. You can customize this summary. It will automatically update as commits are pushed.

- Remove Consent Mode v2 implementation
- Remove URL passthrough and cookieless tracking features
- Switch to Google's standard out-of-the-box gtag.js pattern
- Maintain consent-based loading (scripts only load after user consent)

Rationale:
The standard OoTB implementation is more stable and complies with consent
requirements. The cookieless tracking wasn't working properly, and the
effort to get it working isn't worth the added complexity.
@dleffel dleffel requested review from cte, jr and mrubens as code owners November 5, 2025 04:19
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Nov 5, 2025
@roomote
Copy link
Contributor

roomote bot commented Nov 5, 2025

See this task on Roo Code Cloud

Review completed. All previously identified issues have been resolved.

  • Remove shouldLoad from useEffect dependency array and simplify consent change callback
  • Remove duplicate dataLayer initialization in useEffect
Previous Reviews

Mention @roomote in a comment to trigger your PR Fixer agent and make changes to this pull request.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2025

🚀 Preview deployed!

Your changes have been deployed to Vercel:

Preview URL: https://roo-code-website-i59km9c5l-roo-code.vercel.app

This preview will be updated automatically when you push new commits to this PR.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Nov 5, 2025
@dleffel
Copy link
Collaborator Author

dleffel commented Nov 5, 2025

@roomote address all feedback in this PR.

@roomote
Copy link
Contributor

roomote bot commented Nov 5, 2025

See this task on Roo Code Cloud

Fixed the reported issues. All local checks passed.

View commit | Revert commit

@brunobergher
Copy link
Collaborator

LGTM

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 5, 2025
@mrubens mrubens merged commit e86acef into main Nov 5, 2025
16 checks passed
@mrubens mrubens deleted the chore/simplify-google-analytics-implementation branch November 5, 2025 16:24
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Nov 5, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Nov 5, 2025