Google Universal Analytics, Google Analytics 4 and all MFEs

My next question is analytics based, but not necessarily Open edX based.

Currently in lms/templates/main.html there is a code snippet allowing site operators to collect traffic through Google Universal Analytics.

Google Universal Analytics is going away on July 1, 2023.

Will the code snippet be updated to support Google Analytics 4?

And since we are now in a more Micro Frontend friendly architecture, will the code snippet be added to each MFE so that operators don’t have to fork each MFE in order to add it if they want to follow traffic through the Learning MFE for example?

Who should I talk to?

1 Like

Hi @sambapete ! This sounds like it fits under the purview of the data working group, so I’ve added it to the agenda for the next meeting.

GA is widely used and a very useful tool, and so I can’t see any reason why we shouldn’t continue to support it, and expand its usage into the MFEs.

1 Like

@sambapete, @jill,

I’ve been talking to @BrianMesick about this, and we think it’s important enough to warrant a new epic/discovery around it.

This is the draft description: Modular Web Analytics · Issue #148 · openedx/frontend-wg · GitHub. There’s precious little in there, yet, but it should be enough to get a conversation started. I don’t know if it’ll become an OEP, ADR, or just a PR somewhere, but whatever we do, if we want to continue supporting Google Analytics we need to do it by Palm.

Given the relative urgency, I think this is a good candidate for a funded contribution. I’ll have a talk internally to see if tCRIL would want to fund it ourselves.

Alternatively, if any core contributors want to pick this up to work using their monthly 20 hours, it would, of course, be awesome. :slight_smile:


It’s worth noting that there are two Univeral Analytics flavors - regular and the enterprise scale 360. Regular is the one that @sambapete is referencing above, while 360 will live on until July 1 2024. It’s not clear to me currently what the community uptake is on 360, but that is what is using so they may not feel the same time pressure as other parts of the community. However, I’m sure they would like better coverage for MFEs so that conversation is ongoing.

I’m happy to continue the technical portion of this conversation over in the Issue that Adolfo created, but just wanted to get this bit of context out to the wider audience.


That’s an interesting point. Smaller site operators may not be able to afford 360 for example while someone as big as can.

I can tell you for sure that our site would never be able to afford the prices I’ve seen on What is Google Analytics 360? | FoundSM - Google Analytic Marketing Partner.

The cost of Google Analytics 360 starts out at $150,000 per year and billed at $12,500 a month. Costs can increase as well based on the size of the website. The cost also includes the full suite of tools in the Google Marketing Platform.


Thanks for explaining why this hasn’t been fixed. +1 as a person who’s just running a small site and would in no universe ever be able to afford $150k a year for google analytics! We really need Google Analytics 4 fixed before we lose all visibility!

1 Like

For anyone following this post- we have introduced a funded contribution for getting this work over the line before Google’s deadline: tCRIL Funded Contribution - Google Analytics 4 Upgrade

1 Like

@arbrandes @BrianMesick

After reading over this I noticed that our edx-platform main.html is coming into the frontend-app-learning sequential vertical <iframe/> elements.

This does not satisfy all the MFEs (Account, Profile, Gradebook, etc) or all routes in frontend-app-learning like Outline, Progress.

Looking into how Segment analytics is handled in the frontend-platform code below it makes sense to have a separate configuration for Google Analytics too.

// Initialize for Segment in frontend-platform.
frontend-platform/initialize.js at master · openedx/frontend-platform (

# We problem need to add something like this for Google Analytics 4
import {
  configure as GoogleAnalyticsService
} from './analytics';

configureAnalytics(GoogleAnalyticsService, {
      config: getConfig(),
      loggingService: getLoggingService(),
      httpClient: getAuthenticatedHttpClient(),

# Then we'd need to implement the `GoogleAnalyticService` as a `AnalyticsService` with Google Analytics 4 in mind.

After reading how to implement Google Analytics for React in this post How to Setup and Add Google Analytics to your React App | by Mohammad Faisal | JavaScript in Plain English it seemed to make since about how we may cover the React SPA issue.

Also, here is a npm package react-ga4 - npm ( for Google Analytics 4 that we could use when implementing the GoogleAnalyicsService component.

I realize that Segment can have a destination for Google Analytics 4 too and maybe this would circumvent any need to extend the frontend-platform analytics component. To configure Segment properly for Google Analytics deliver you’d need to setup the correct mappings for each event though. Also what happens if you want to just use Google Analytics and not Segment.

Let me know if I’m in the right understanding about how one would approach adding Google Analytics 4 into the MFEs by use of extending the analytic component in frontend-platform. Has any work been done to date on integrating Google Analytics 4 into the MFEs?

cc @traek728 @becdavid

Thanks for looking into this, Zachary.

Not yet, but we put out a call for a funded contribution to fix the issue for Palm, and I believe we’ve selected a vendor, already. This means work should start soon.

Thanks @arbrandes for the response. We’ll keep check to see what happens with the Palm updates for this feature request. Is there any way that someone can keep us informed through this post once this is implemented?

@Zachary_Trabookis, I suggest taking a peek into this issue and this wiki page every so often. From those you should be able to glean what the status of the work is!


@arbrandes At Configuring Google Analytics — Latest documentation it says “Google Analytics 4 is supported in most edx-platform LMS templates and the following micro-frontends (MFEs) in the upcoming Olive.4 and Palm named releases”.

I just wanted to confirm, I’m not able to test this as of today’s Olive, because it’s not “Olive.4”, correct?

(I did actually test it, via making the change from the admin interface as specified, and I just saw no updates to the page HTML. So I want to make sure the reason that’s true is because it’s just not actually in the current Olive release?)

That is correct. This change will only be available once Olive.4 is released (in about two weeks).