-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Google Analytics 4 Support #5970
Comments
Legato doesn't seem to support GA4. |
Thank you for working on this! I just wanted to link to this (one-year-old) incomplete Legato PR for future reference: tpitale/legato#141 |
Some suggestions were also added in the palni-palci ticket above but work on implementation is not currently planned on this ticket. |
For querying analytics for populating Sushi counter metrics, I wrote up: https://github.com/scientist-softserv/hyrax-analytics-g4/tree/main |
Per Google, on July 1, 2023, Universal Analytics properties will no longer process data. Hyrax will need to support GA4.
HYRAX_ANALYTICS_PROVIDER
could have an additional option (ga4
) or GA4 properties could be detected by checking the prefix. Adding a new js snippet for GA4 properties will be relatively easy.It looks like GA4 supports turbolinks page navigations out of the box (need to test) so event tracking will be simplified. No need for
setupTracking()
on every page refresh. But Hyrax file download links don't end in extensions, so there's work to do to make sure file downloads are tracked.The GA4 API is different enough that the easy interop between matomo and UA won't work with GA4. Instead of pushing events to a special array, you need to call the
gtag
function. For backwards compatibility, we've updated theTrackingTags
class'sanalytics()
function like so:That says 'if you're matomo, return the
_paq
array object which works as expected. If not (in our env), we're using GA4. In that case, return a new object with a function called 'push' which translates the array pushes from UA/Matomo intogtag()
calls'. It's just a quick hack to prevent js console errors on our test IRs.Future work:
The text was updated successfully, but these errors were encountered: