break(gtag): forbid deprecated anonymizeIP option (AI-assisted)#11878
Open
Injora wants to merge 4 commits intofacebook:mainfrom
Open
break(gtag): forbid deprecated anonymizeIP option (AI-assisted)#11878Injora wants to merge 4 commits intofacebook:mainfrom
Injora wants to merge 4 commits intofacebook:mainfrom
Conversation
Google Analytics 4 does not log or store IP addresses, making the anonymize_ip configuration unnecessary. This option has been a no-op since GA4's launch and was marked for deprecation since June 2023. - Remove anonymizeIP from PluginOptions and Options types - Remove anonymize_ip from the gtag config snippet - Mark anonymizeIP as forbidden in the Joi schema with a clear error message for existing users - Update tests to verify the forbidden validation See: https://support.google.com/analytics/answer/2763052
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
slorber
reviewed
Apr 2, 2026
Collaborator
slorber
left a comment
There was a problem hiding this comment.
Thanks
This is technically a breaking change since we forbid the attribute that was previously allowed (even though noop), so I'll merge this later for Docusaurus v4.
Author
|
Thanks! That makes sense regarding it being a breaking change. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Google Analytics 4 does not log or store IP addresses, making the
anonymize_ipconfiguration unnecessary. This option has been a no-op since GA4's launch and was marked for deprecation since June 2023.anonymizeIPfromPluginOptionsandOptionstypesanonymize_ipfrom the gtag config snippetanonymizeIPas forbidden in the Joi schema with a clear error message for existing usersSee: https://support.google.com/analytics/answer/2763052
Pre-flight checklist
Motivation
The
anonymizeIPoption in@docusaurus/plugin-google-gtaghas been a no-op since GA4 replaced Universal Analytics. GA4 does not log or store IP addresses at all, making IP anonymization unnecessary.The codebase already had a TODO acknowledging this should be removed:
https://github.com/facebook/docusaurus/blob/main/packages/docusaurus-plugin-google-gtag/src/options.ts#L16-L20
This PR completes that TODO by removing the dead option and providing a clear error message for existing users who still have it in their config, following the same
Joi.forbidden()pattern used byhomePageIdinplugin-content-docs.Test Plan
yarn test packages/docusaurus-plugin-google-gtag/src/__tests__/options.test.tsAll 14 tests pass. Full build passes with yarn build:packages.