Add tutor-contrib-google-analytics plugin#63
Draft
arbrandes wants to merge 1 commit intoopenedx:mainfrom
Draft
Conversation
2 tasks
This was referenced Apr 18, 2026
Duplicates the GoogleAnalyticsLoader from frontend-platform and registers it for all MFEs via tutor-mfe's EXTERNAL_SCRIPTS hook. Co-Authored-By: Claude <noreply@anthropic.com>
1728af7 to
dd8c5e2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Adds a new
tutor-contrib-google-analyticsplugin that ships theGoogleAnalyticsLoaderonce bundled with@openedx/frontend-platform, so Google Analytics tracking keeps working as Open edX frontends migrate away from frontend-platform.The plugin inlines a single JavaScript class and wires it into both build pipelines that
tutor-mfesupports. For legacy MFEs, the class is injected intoenv.config.jsxvia themfe-env-config-buildtime-definitionspatch and registered throughtutormfe.hooks.EXTERNAL_SCRIPTS. For the new frontend-base site, the same class is injected intocustomApp.tsxviamfe-site-custom-app-definitionsand registered throughtutormfe.hooks.FRONTEND_SCRIPTS, which attaches it tocustomApp.externalScriptsat build time.The loader reads
GOOGLE_ANALYTICS_4_IDfrom the MFE runtime configuration (legacy) or fromcommonAppConfig(frontend-base). Without a value it is a safe no-op, so enabling the plugin before Google Analytics is configured is harmless.Depends on openedx/frontend-base#129, overhangio/tutor-mfe#285, and overhangio/tutor-mfe#290.
LLM usage notice
Built with assistance from Claude.