Multiplexed Google Analytics support GA4 with UA backward compatibility #1
Open
sohale wants to merge 8 commits intobovlb:masterfrom
Open
Multiplexed Google Analytics support GA4 with UA backward compatibility #1sohale wants to merge 8 commits intobovlb:masterfrom
sohale wants to merge 8 commits intobovlb:masterfrom
Conversation
Create publish-gem.yml
This should work with both old Universal Analytics (UA) and new Google Analytics v4 (GA4). Resolves pages-themes#63
This solution can be extended if we wanted to long-term support other tracking ID versions or variants. The user can just specify the property for their version/variant in _config.yml
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.
Dual Compatibility for Google Analytics Support: v4 (GA4) and UA
This PR provides a sustainable solution for issue #63 by enabling the theme to support both Google Analytics v4 (GA4) and Universal Analytics (UA) tracking IDs.
The user only sets the
google_analytics_v4:. The legacy users can keep usinggoogle_analytics:. The user does not even need to be aware of the other version. It feels like auto-detection.Key Features
google_analytics_v4(GA4) andgoogle_analytics(UA) configuration variables in_config.yml._config.ymlas needed. Even if they use both, in theory is will make sense: they may want to use it to track the page by two Analytics IDs.Usage
In your
_config.yml:Note: