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.
The old Universal Analytics support ended on July 1st, 2023. This migrates to GA4.
This may resolve #310
I believe this code is working - at least for the non-PRO case. I can't test PRO (e.g. cookie banner) since I don't have access. So I've tried to interpret the old code and I hope get close to what was happening there. That being said, I'd really suggest testing and likely improving this before merge. I don't have deep knowledge on Hydejack, GA or even Jekyll. 🤷 This just seems to work for my use-case.
There are some major GA4 changes. Initialization is different, consent is different and binding to browser history API is automatic if enabled in the GA control panel (default is on).
I'll be doing further testing of this in the coming week, but wanted to post this as a starting point.
useful:
comparison of GA with GTAG function calls
https://developers.google.com/tag-platform/security/guides/consent
https://developers.google.com/analytics/devguides/collection/ga4/reference/config