Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Google Analytics 4 #1709

Closed
laurenwalker opened this issue Mar 30, 2021 · 3 comments
Closed

Support Google Analytics 4 #1709

laurenwalker opened this issue Mar 30, 2021 · 3 comments

Comments

@laurenwalker
Copy link
Member

Add configurable support for the new version of Google ANalytics (4) which uses the gtag.js API instead of analytics.js. We may want to support using both since Google ANalytics still seems somewhat immature and metacatui users may want to support both versions for a while before fully switching over.

@laurenwalker
Copy link
Member Author

Google is dropping support for Universal Analytics and will only be supporting GA4 after July 1, 2023. https://support.google.com/analytics/answer/10089681

MetacatUI should soft deprecate UA support for GA4 and eventually deprecate UA within a year.

@robyngit robyngit added this to the 2.25.0 milestone Jun 27, 2023
@robyngit
Copy link
Member

from #2149 (comment) @mbjones said:

Hi robyn I keep getting notices about the Google Analytics changes that are upcoming. This is the final week to update Google Analytics tag (UA-) to the Google tag (G-) using the GA-4 platform for all sites. Starting July 1, tracking will stop on a site if a new GA-4 property is not connected. My impression from looking at our site is that Google might automatically create GA-4 properties for our existing ones, but I’m not sure of that. Could you look into it and try to be sure we don’t drop our tracking accidentally, especially on core sites like dataone.org, search.dataone.org, arcticdata.io, the KNB site, and the hosted repository sites? cc @nickatnceas

@robyngit robyngit self-assigned this Jun 27, 2023
robyngit added a commit that referenced this issue Jun 28, 2023
- switch from using universal analytics with analytics.js to google analytics for with gtag.js
- move analytics logic into a model that handles initializing gtag, checking if google analytics is enable, sending events, etc.
- create a base analytics model that can be extended in the future to use a service other than google analytics

Issues #1709 and #2149
@robyngit
Copy link
Member

robyngit commented Jun 28, 2023

Changes to support GA4 have been made in the feature-1709-GA4 branch.

In light of the fact that we may switch to a different analytics service in the future (#2149), I took the approach of moving all of the analytics logic to a model. An instance of this model gets attached to the global MetacatUI object as the .analytics property. I created both a generic Analytics model, and an extension of that one called GoogleAnalytics. This will hopefully allow us to simply swap out the GoogleAnalytics model for a difference Analytics model in order to switch services.

Left to do:

  • Configure the new GA-4 properties for each of our repos
  • Test that the new set up works as expected
  • Add release notes and possibly additional docs to help repo owners transition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants