Page MenuHomePhabricator

Make `homepage` (Special:Homepage) identifiable in `page_visit` events
Closed, ResolvedPublic2 Estimated Story Points

Description

Background

The early onboarding experiment T437339: Recommended reading exp: Instrument user interaction on module reads its page visits from the client-side page_visit events sent by anyPageVisit in WikimediaEvents. Those events request only page_namespace_id, so Special:Homepage cannot be told apart from any other special page. The server-side page_visit from SpecialHomepage.php would carry page_title, but the experiment does not use it.

The instrumentation spec asks for action_context: { page: homepage } on page visits. The new withContext helper T438898: Add wrapper helpers to add more context to analytics events already provides the mechanism.

Goal

Make Special:Homepage identifiable in the experiment's page_visit events, so the "Pageviews of homepage" metric can be calculated easily.

Acceptance criteria for done

  • page_visit events sent on Special:Homepage carry page: homepage in action_context; events on other pages do not.
  • Don't send action_context when there is nothing to record, instead of "{}".
  • Events validate against analytics/product_metrics/web/base/2.0.0 (action_context is a string; see T437122: Launch experiment for donor consent).

Event Timeline

Change #1345050 had a related patch set uploaded (by VolkerE; author: VolkerE):

[mediawiki/extensions/WikimediaEvents@master] EarlyOnboarding: Record homepage visits in `action_context` explicitly

https://gerrit.wikimedia.org/r/1345050

Change #1345660 had a related patch set uploaded (by VolkerE; author: VolkerE):

[mediawiki/extensions/GrowthExperiments@master] instrument(AccountSetup): Record setup motivation on `page_visit`

https://gerrit.wikimedia.org/r/1345660

Change #1345050 abandoned by VolkerE:

[mediawiki/extensions/WikimediaEvents@master] EarlyOnboarding: Identify homepage visits via `page_title`

https://gerrit.wikimedia.org/r/1345050

Change #1345660 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] instrument(AccountSetup): Record setup motivation on `page_visit`

https://gerrit.wikimedia.org/r/1345660

Change #1347743 had a related patch set uploaded (by VolkerE; author: VolkerE):

[mediawiki/extensions/GrowthExperiments@wmf/1.47.0-wmf.22] instrument(AccountSetup): Record setup motivation on `page_visit`

https://gerrit.wikimedia.org/r/1347743

Change #1347743 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@wmf/1.47.0-wmf.22] instrument(AccountSetup): Record setup motivation on `page_visit`

https://gerrit.wikimedia.org/r/1347743

Mentioned in SAL (#wikimedia-operations) [2026-10-01T20:14:28Z] <cjming@deploy1003> Started scap sync-world: Backport for [[gerrit:1347606|fix(ReadingRecommendations): Update button style to primary (T436332)]], [[gerrit:rEDOI13477127b80e|instrument(WelcomeSurvey): align motivation event with AccountSetup (T439887)]], [[gerrit:1347743|instrument(AccountSetup): Record setup motivation on page_visit (T439217)]]

Mentioned in SAL (#wikimedia-operations) [2026-10-01T20:18:22Z] <cjming@deploy1003> cjming, volker-e: Backport for [[gerrit:1347606|fix(ReadingRecommendations): Update button style to primary (T436332)]], [[gerrit:rEDOI13477127b80e|instrument(WelcomeSurvey): align motivation event with AccountSetup (T439887)]], [[gerrit:1347743|instrument(AccountSetup): Record setup motivation on page_visit (T439217)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can

Mentioned in SAL (#wikimedia-operations) [2026-10-01T20:32:57Z] <cjming@deploy1003> Finished scap sync-world: Backport for [[gerrit:1347606|fix(ReadingRecommendations): Update button style to primary (T436332)]], [[gerrit:rEDOI13477127b80e|instrument(WelcomeSurvey): align motivation event with AccountSetup (T439887)]], [[gerrit:1347743|instrument(AccountSetup): Record setup motivation on page_visit (T439217)]] (duration: 18m 28s)

Tested on enwiki beta de-1-3-1-specialhomepage-onboarding-ab-test: The enrollment for this experiment has been overridden. The following event will not be sent:

  • page_visit does include non-empty action_context
  • "page" includes reference to "namespace_id": -1 not explicitly to homepage. Should it be enough?

https://en.wikipedia.beta.wmcloud.org/w/index.php?title=Special%3AHomepage&namespace=-1&accountJustCreated=1

page_visit {
  "action_source": "external_referrer",
  "action_context": "{\"user_motivation\":\"skipped\"}"
} {
  "agent": {
    "client_platform": "mediawiki_js",
    "client_platform_family": "mobile_browser"
  },
  "page": {
    "namespace_id": -1
  }
}
  • a visit to another page (main namespace) will look like:
de-1-3-1-specialhomepage-onboarding-ab-test: The enrollment for this experiment has been overridden. The following event will not be sent:
 page_visit {
  "action_source": "external_referrer",
  "action_context": "{\"user_motivation\":\"skipped\"}"
} {
  "agent": {
    "client_platform": "mediawiki_js",
    "client_platform_family": "mobile_browser"
  },
  "page": {
    "namespace_id": 0
  }
}
Volker_E updated the task description. (Show Details)

Thanks @Etonkovidova! We've had a longer discussion about page: homepage which would rely on page_title and that would mean elevated data collection risk. Therefore we settled on "namespace_id": -1 and rely on the general special page as identifier.

Tested on enwiki beta de-1-3-1-specialhomepage-onboarding-ab-test: The enrollment for this experiment has been overridden. The following event will not be sent:

  • "page" includes reference to "namespace_id": -1 not explicitly to homepage. Should it be enough?

discussed with Volker offline, and I believe the current tracking is what we settled on with Jennifer to be able to preserve privacy while still having what we need to calculate the experiment's primary metric. Signing off.