Add platform-level UTM capture support for authenticated MFE users

未关闭
#892 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
45/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
javascript

调研方向

首先跟踪 frontend-platform 中的 initialize()、经过身份验证的 HTTP 客户端和 logout,以确定捕获、传输和清理的集成点。在决定 cookie 和请求标头应如何工作之前,先查看 RFC 上下文和现有的配置模式。完成的标准是:经过身份验证的 MFE 请求始终携带捕获的 UTM 数据,并且 logout 会移除这些数据;在不存在 UTM 参数时,行为不发生变化。

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
JavaScript
星标
38
派生
90
平均合并
3 分钟
30 天内合并 PR
4

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

openedx/frontend-platform 的其他 Issue

查看 openedx/frontend-platform 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。