Page MenuHomePhabricator

Implement instrumentation code for HomepageVisit schema
Closed, ResolvedPublic

Description

The schema is proposed in T219432: Homepage: HomepageVisit schema specification. This task is for writing the code to implement it.

We'll want to:

  1. Log from SpecialHomepage->execute()
  2. Use the query parameter from the HTTP REFERER header to get "view" or "edit" as the action
  3. Parse the HTTP REFERER to obtain the namespace the user came from
  4. Rewrite user link in personal tools and user / user talk tabs to add a query parameter

Schema:

1{
2 "description": "Log visits to Special:Homepage (provided by Extension:GrowthExperiments) from the server-side.",
3 "properties": {
4 "is_mobile": {
5 "type": "boolean",
6 "required": true,
7 "description": "If the event is associated with the mobile web frontend."
8 },
9 "referer_route": {
10 "type": "string",
11 "required": false,
12 "description": "The route the user took to arrive at the Special:Homepage. Calculated by looking at the query parameter.",
13 "enum": [
14 "userpagetab",
15 "usertalkpagetab",
16 "personaltoolslink",
17 "direct",
18 "other"
19 ]
20 },
21 "referer_namespace": {
22 "type": "integer",
23 "required": false,
24 "description": "The namespace associated with the MediaWiki Title (e.g. 0, for Main_Page) that is the referer to this page. Calculated by attempting to load a MediaWiki title from parsing the HTTP REFERER header"
25 },
26 "referer_action": {
27 "type": "string",
28 "required": false,
29 "enum": [
30 "view",
31 "edit",
32 "other"
33 ],
34 "description": "The action associated with the user activities on the MediaWiki Title that is the referer to this page. Calculated by looking at the action parameter in the query string of the HTTP REFERER header."
35 },
36 "user_editcount": {
37 "type": "integer",
38 "required": true,
39 "description": "The user edit count."
40 },
41 "user_id": {
42 "type": "integer",
43 "required": true,
44 "description": "User ID, needed for tracking across login sessions."
45 },
46 "impact_module_state": {
47 "type": "string",
48 "required": true,
49 "enum": [
50 "activated",
51 "unactivated"
52 ],
53 "description": "Activation state of the impact module."
54 },
55 "start_tutorial_state": {
56 "type": "string",
57 "required": true,
58 "enum": [
59 "complete",
60 "incomplete"
61 ],
62 "description": "Completion state of the tutorial module."
63 },
64 "start_userpage_state": {
65 "type": "string",
66 "required": true,
67 "enum": [
68 "complete",
69 "incomplete"
70 ],
71 "description": "Completion state of the userpage module."
72 },
73 "start_email_state": {
74 "type": "string",
75 "required": true,
76 "enum": [
77 "noemail",
78 "unconfirmed",
79 "confirmed"
80 ],
81 "description": "Completion state of the email module."
82 },
83 "homepage_pageview_token": {
84 "type": "string",
85 "required": true,
86 "description": "One-time token per page load. This is a random user session ID that will be exported to the client-side, so that HomepageModule schema events can be associated with this HomepageVisit event."
87 }
88 }
89}

Event Timeline

Change 500120 had a related patch set uploaded (by Kosta Harlan; owner: Kosta Harlan):
[mediawiki/extensions/GrowthExperiments@master] (wip) HomepageVisit logging

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

Change 500120 merged by jenkins-bot:
[mediawiki/extensions/GrowthExperiments@master] HomepageVisit schema logging

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

Change 506198 had a related patch set uploaded (by Kosta Harlan; owner: Kosta Harlan):
[mediawiki/extensions/GrowthExperiments@master] EventLogging: Make namespace int, use enum for impact module state

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

Change 506210 had a related patch set uploaded (by Kosta Harlan; owner: Kosta Harlan):
[mediawiki/extensions/GrowthExperiments@wmf/1.34.0-wmf.1] EventLogging: Make namespace int, use enum for impact module state

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

Change 506198 merged by jenkins-bot:
[mediawiki/extensions/GrowthExperiments@master] EventLogging: Make namespace int, use enum for impact module state

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

Change 506210 merged by jenkins-bot:
[mediawiki/extensions/GrowthExperiments@wmf/1.34.0-wmf.1] EventLogging: Make namespace int, use enum for impact module state

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