In T219435: Homepage: HomepageModule schema we've defined the schema for HomepageModule, this task is for writing the code.
The instrumentation code will all be client-side, but note that the homepage_pageview_token originates in the server-side logging for HomepageVisit schema
| 1 | { |
|---|---|
| 2 | "description": "Logs interactions with the homepage modules on the Special:Homepage provided by the GrowthExperiments extension", |
| 3 | "properties": { |
| 4 | "action": { |
| 5 | "type": "string", |
| 6 | "required": true, |
| 7 | "enum": [ |
| 8 | "impression", |
| 9 | "hover-in", |
| 10 | "hover-out", |
| 11 | "link-click" |
| 12 | ], |
| 13 | "description": "Action the user took:\n\n- impression: Module is shown to user\n\n- hover-in: User mouse pointer enters the element.\n\n- hover-out: User mouse pointer leaves the element\n\n- link-click: User clicks a link in the module" |
| 14 | }, |
| 15 | "action_data": { |
| 16 | "type": "string", |
| 17 | "description": "Additional data for certain actions:\n\nFor action=link-click: symbolic name of the link being clicked. n.b. for impact module links, we will not append a number for each link in the list.\n\nFor mentorship module, we will add the mentor edit count and the unformatted timestamp that the editor was last active." |
| 18 | }, |
| 19 | "user_id": { |
| 20 | "type": "integer", |
| 21 | "required": true, |
| 22 | "description": "The user id." |
| 23 | }, |
| 24 | "user_editcount": { |
| 25 | "type": "integer", |
| 26 | "required": true, |
| 27 | "description": "The total number of edits of the user." |
| 28 | }, |
| 29 | "module": { |
| 30 | "type": "string", |
| 31 | "enum": [ |
| 32 | "start-account", |
| 33 | "start-tutorial", |
| 34 | "start-userpage", |
| 35 | "start-email", |
| 36 | "impact", |
| 37 | "help", |
| 38 | "mentorship" |
| 39 | ], |
| 40 | "required": true, |
| 41 | "description": "The module the user is interacting with" |
| 42 | }, |
| 43 | "state": { |
| 44 | "type": "string", |
| 45 | "enum": [ |
| 46 | "complete", |
| 47 | "incomplete", |
| 48 | "activated", |
| 49 | "unactivated", |
| 50 | "noemail", |
| 51 | "unconfirmed", |
| 52 | "confirmed" |
| 53 | ], |
| 54 | "required": false, |
| 55 | "description": "The state of the module the user is interacting with." |
| 56 | }, |
| 57 | "is_mobile": { |
| 58 | "type": "boolean", |
| 59 | "required": true, |
| 60 | "description": "Whether the mobile site is being used." |
| 61 | }, |
| 62 | "homepage_pageview_token": { |
| 63 | "type": "string", |
| 64 | "required": true, |
| 65 | "description": "One-time token per page load. This is a random user session ID that will be exported to the client-side when HomepageVisit events are recorded." |
| 66 | } |
| 67 | } |
| 68 | } |