Skip to content

Add tutor-contrib-google-analytics plugin#63

Draft
arbrandes wants to merge 1 commit intoopenedx:mainfrom
arbrandes:arbrandes/google-analytics
Draft

Add tutor-contrib-google-analytics plugin#63
arbrandes wants to merge 1 commit intoopenedx:mainfrom
arbrandes:arbrandes/google-analytics

Conversation

@arbrandes
Copy link
Copy Markdown
Contributor

Description

Adds a new tutor-contrib-google-analytics plugin that ships the GoogleAnalyticsLoader once 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-mfe supports. For legacy MFEs, the class is injected into env.config.jsx via the mfe-env-config-buildtime-definitions patch and registered through tutormfe.hooks.EXTERNAL_SCRIPTS. For the new frontend-base site, the same class is injected into customApp.tsx via mfe-site-custom-app-definitions and registered through tutormfe.hooks.FRONTEND_SCRIPTS, which attaches it to customApp.externalScripts at build time.

The loader reads GOOGLE_ANALYTICS_4_ID from the MFE runtime configuration (legacy) or from commonAppConfig (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.

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>
@arbrandes arbrandes force-pushed the arbrandes/google-analytics branch from 1728af7 to dd8c5e2 Compare April 19, 2026 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create tutor-googleanalytics example plugin

1 participant