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

Modular Web Analytics #148

Closed
19 tasks done
arbrandes opened this issue Nov 21, 2022 · 6 comments
Closed
19 tasks done

Modular Web Analytics #148

arbrandes opened this issue Nov 21, 2022 · 6 comments
Assignees
Labels
candidate for funding epic Large unit of work, consisting of multiple tasks

Comments

@arbrandes
Copy link

arbrandes commented Nov 21, 2022

Motivation

To begin, Google Universal Analytics will stop working on July 1, 2023, and it's all the current snippet in the LMS supports. We'll either need to deprecate/remove this by then, or move to support Google Analytics 4 (as has been requested in the forum).

In parallel, we need to investigate the possibility of supporting GA in MFEs (something that has also been requested explicitly).

Possible solutions

Loading arbitrary javascript

One could allow operators to define custom external scripts to be loaded in the head of server-side rendered pages or MFEs; the operator would be able to load any arbitrary analytics engines that way.

OEP-15 proposed a way to do this for entires courses; see its implementation. A similar thing could be done for both LMS server-side pages and MFEs. The latter, in particular, could be served a list of custom JS (maybe even snippets) via runtime configuration, which in turn supports site configuration, thus allowing for per-domain analytics configuration.

However, an attempt to bring this into the Learning MFE was rejected at the time for good reasons. Loading generic scripts can throw a wrench into SPA react apps.

Questions:

  • Would it even make sense to load, say, a Google Analytics snippet at runtime into the <head/> of an MFE without explicit react-router integration? Would page changes be detected properly?
  • Even if this works, is it really the best way to support analytics going forward?

Explicit support for analytics engines in MFEs

frontend-platform already has explicit support for Segment in what looks to be a modular analytics service framework. frontend-app-learning, for instance, tracks clicks using it.

It should be possible to implement GA and others using this method. However, each MFE would have to be modified to support the desired tracking.

Support for analytics engines in a containing SPA

Once Modular MFE Domains are a thing, it would be relatively simple to support modular analytics engines at the containing SPA level. Because routing would be done for MFEs at this level, page tracking need not be done in an MFE itself. Event tracking would still have to be done by the MFE, of course, but all MFEs would use the same instance of the analytics service interface.

Foundational

  1. open-source-contribution

PRs against Palm

  1. open-source-contribution
  2. open-source-contribution
  3. open-source-contribution
  4. open-source-contribution
  5. open-source-contribution
  6. open-source-contribution

PRs agains Olive

  1. open-source-contribution
  2. open-source-contribution
  3. open-source-contribution
  4. open-source-contribution
  5. open-source-contribution
  6. open-source-contribution
@arbrandes arbrandes added epic Large unit of work, consisting of multiple tasks candidate for funding labels Nov 21, 2022
@arbrandes
Copy link
Author

@bmtcril, some food for thought. Might become an ADR or even an OEP. I no longer think our original approach is the best idea, but it's listed as the first possible solution, above.

The second one is probably the best we'd be able to do before Modular MFE Domains kick in. It looks reasonably self-contained, so we should be able to make a funded project out of it.

Definitely not for Olive, though. And we'd need to get things rolling pretty quickly if we want to get ready by Palm - which we pretty much have to if we want to continue supporting Google Analytics in any fashion.

@arbrandes arbrandes changed the title Modular Analytics Modular Web Analytics Nov 21, 2022
@arbrandes
Copy link
Author

arbrandes commented Nov 21, 2022

@bmtcril
Copy link

bmtcril commented Nov 22, 2022

Thanks for writing all of this up @arbrandes ! I agree the second option will get us out of the current problem, but there are so many players in the analytics space that operators might want to integrate with I don't think it will scale for us in the long term. I'll definitely keep an eye on the MFE Domains planning to see what we can do to keep this use case in mind during the process, but in the meantime I'd be ok with implementing the Segment-style integration for GA to get us through.

@arbrandes
Copy link
Author

@bmtcril, I believe all PRs are merged, now. Can you check and see if I missed anything?

@bmtcril
Copy link

bmtcril commented May 10, 2023

This looks good to me, let me just double check with RG that there's nothing outstanding and we can close this beast! Thanks for the heroic efforts.

@bmtcril
Copy link

bmtcril commented May 17, 2023

Raccoon Gang believes this is done as well and has sent the close out report. Closing!

@bmtcril bmtcril closed this as completed May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
candidate for funding epic Large unit of work, consisting of multiple tasks
Projects
Status: Closed
Development

No branches or pull requests

2 participants