Add platform-level UTM capture support for authenticated MFE users

Aperta
#892 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
javascript

Direzione di ricerca

Inizia tracciando initialize(), il client HTTP autenticato e logout in frontend-platform per identificare i punti di integrazione per la cattura, il trasporto e la pulizia. Esamina il contesto dell’RFC e i pattern di configurazione esistenti prima di decidere come devono funzionare il cookie e l’header della richiesta. Il lavoro è completato quando le richieste MFE autenticate includono costantemente i dati UTM catturati e logout li rimuove, senza cambiamenti di comportamento quando non sono presenti parametri UTM.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Problem

Today, UTM parameters are typically captured when unauthenticated users enter the platform through login or registration flows because Django receives the initial request.

However, when an already-authenticated learner lands directly on an MFE page via a marketing campaign URL, the page is rendered entirely client-side and Django never sees the initial page load. As a result, UTM parameters may be visible in the browser URL but are not automatically transmitted to backend services.

For authenticated users, this attribution information is currently lost unless each MFE implements its own custom solution.

Current Workarounds

Current approaches typically involve one or more of the following:

  • Implementing UTM capture independently in every MFE
  • Relying solely on third-party analytics solutions
  • Propagating UTM parameters through internal navigation

These approaches duplicate logic across repositories and require ongoing maintenance whenever new MFEs are introduced.

Proposal

Add generic UTM capture support to frontend-platform so that all MFEs using the framework can benefit automatically.

1. Capture UTM parameters during initialization

Introduce a small utility that:

  • Reads standard UTM parameters from the current URL
  • Captures:
    • utm_source
    • utm_medium
    • utm_campaign
    • utm_term
    • utm_content
  • Persists them in a configurable cookie

The utility would be invoked from initialize() so capture occurs before authentication setup and outbound API requests.

2. Attach captured UTM data to authenticated requests

Add an interceptor to the authenticated HTTP client that:

  • Reads the stored UTM payload
  • Includes it in outbound authenticated requests through a dedicated header (for example, X-Openedx-Utm-Params)

This also provides a fallback path for environments where cookie-based transport may be restricted.

3. Cleanup on logout

Remove the stored UTM data during logout to avoid attribution data persisting across sessions on shared devices.

Benefits

  • No per-MFE implementation required
  • Works across existing and future MFEs built on frontend-platform
  • Provides a consistent mechanism for transporting attribution data
  • Reduces duplication across repositories
  • Fully additive and inactive when no UTM parameters are present

Questions for Discussion

  • Is UTM capture considered an appropriate responsibility for frontend-platform?
  • Is a cookie + request-header approach acceptable, or is there a preferred platform-level mechanism?
  • Is initialize() the right integration point for capturing campaign parameters?
  • Are there privacy, security, or configurability concerns that should be addressed before adopting this capability?

Additional Context

This issue is based on an RFC proposing a platform-wide solution for preserving UTM attribution for authenticated learners landing directly on MFE pages from external campaigns.

The frontend-platform changes described here are intended to provide the generic capture and transport layer, while backend persistence and attribution modeling would remain separate concerns.

Lingua principale
JavaScript
Stelle
38
Fork
90
Merge medio
3m
PR unite (30g)
4

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di openedx/frontend-platform

Tutte le issue di openedx/frontend-platform

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.