Forecast-UX instrumentation for the Questions/Metrics doc

Aperta
#1,487 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
32/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Attiva
Stack tecnologico
next.js, typescript
Ambito
analytics

Direzione di ricerca

Start by reviewing the PostHog Questions/Metrics doc and the proposed event list in this issue. The event list still needs stakeholder agreement, acceptance criteria have not been written, and implementation is blocked by NationalAvalancheCenter/afp-public-widgets#313. Once the events are agreed, the work is expected to split into separate widgets and AvyWeb issues.

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

Descrizione

enhancement ready-for-human

This was generated by AI during triage.

Parent

#1484

What this is

The plan of record for answering the questions in the PostHog Questions/Metrics doc. Stakeholders reviewed a plain-language version of this plan in Google Drive, which also covers costs and billing. This issue holds the agreed questions, decisions and event spec, and stays open as the parent until the implementation issues close. After release, docs/analytics-events.md in the widgets repo is the source of truth for event names and properties.

Implementation

In build order:

  • NationalAvalancheCenter/afp-public-widgets#318: media_opened fires once per stale lightbox listener (draft PR NationalAvalancheCenter/afp-public-widgets#317)
  • NationalAvalancheCenter/afp-public-widgets#319: forecast reading events
  • NationalAvalancheCenter/afp-public-widgets#320: media engagement events
  • NationalAvalancheCenter/afp-public-widgets#321: observation engagement events
  • NWACus/web#1509: the same events on native AvyWeb pages, once a center switches to native forecast pages

Priorities

  • Rusty: text formatting, what gets viewed together, and annotated photos, avalanche photos and plots. Start with more and cut later.
  • Ethan: where users spend the most time, text formatting in forecasts and observations, and what media performs best.
  • Aaron: aligned with Rusty.

Questions and how we'll answer them

Question Answered by
Where do users spend the most time? Which part of the forecast? What's least used? forecast_read, forecast_tab_changed
Is that a navigation problem, or just not useful? Sampled session replay, AvyWeb only
Where do users leave? Do they step away and come back? last_section and seconds_away on forecast_read, Web Analytics
Do users use hyperlinks? forecast_link_clicked
Are info bubbles, glossary terms and danger controls used, including on phones? Existing events, split by device. See below.
Does text formatting affect time spent, in forecasts and observations? Word and formatting counts on forecast_read and observation_read
Do people read differently depending on the forecast? Forecast context on forecast_viewed and forecast_read
What media performs best? Annotated photos, avalanche photos, plots? Does caption length matter? Video retention? media_opened, media_viewed, media_id classified after the fact, and YouTube Studio
Map or list? Modal or full page? Can we order the list better? observation_opened properties
What kinds of observations get opened? observer_type, has_media, has_avalanches, has_cracking, has_collapsing
Which parts of an observation do people read? observation_read
Do users move between centers on the maps? zone_center on forecast_zone_clicked
What gets viewed together? Who, where from, how many, which device? Paths, Funnels and Web Analytics on existing data
How does use differ by user group (motorized, demographics)? Not this season. See below.

Decisions

  • Widgets first. nativeProducts.forecast is off for every center, so widgets are the only forecast surface with traffic. Native pages adopt this spec when a center's flag is planned.
  • Passive events are summaries. They're sent only on the send triggers below, never per scroll or per section. Only user actions send an event per action.
  • One summary event replaces forecast_section_viewed and media_shown. Per-section events cost 3 to 5 events per view, and "half in view" can never be true for a section taller than two viewports.
  • video_progressed is cut. It needs the YouTube player API on every center's site and a rework of the lightbox on both hosts. YouTube Studio covers per-video retention, and media_viewed gives a rough open time.
  • Content categories are classified after the fact. The AFP has no annotated-photo or plot type, so we record media_id and classify the most-opened items during analysis.
  • Forecast attributes travel on the events. The ones we'll chart by (danger, problems, media count, age, length and formatting) are sent as properties, which cost nothing extra. Anything else is derived later from product_id.
  • The author isn't recorded. It would invite casual comparisons between forecasters. It stays recoverable from product_id.

Event spec

widget, center, source, environment, host_source and on_dashboard are added by the analytics module.

forecast_read (new)

Sent for zone forecast views, including archived ones. It is not sent for the all-zones view.

Sent when the first of these happens, and at least one new second has accrued:

  • visibilitychange to hidden, with pagehide as a fallback
  • Navigating to another zone or date inside the widget
  • The widget unmounting

A view is one zone forecast for one date in one page lifetime. It starts when the forecast mounts. It ends on navigation to another zone or date, unmount, or page unload. Becoming hidden doesn't end it, and neither do the in-widget tabs. A bfcache restore continues the same view.

If the reader returns, timers resume and the next send carries only what accrued since the last send, with the same view_id. A view is the sum of its events: count views by distinct view_id, not by event. Use sendBeacon transport.

Counting time:

  • Each moment is shared between the sections on screen, weighted by where on the screen readers tend to look: a bell curve centred 49.2% down the viewport, with a standard deviation of 20.1% of its height. This is the Gaussian Viewport Attention Model, with the numbers as published, of Grusky et al., CHI 2017. A section alone on screen gets all of the time. This is seconds_*.
  • Each section on screen is also credited the full time, as visible_seconds_*: a number with no assumptions in it, to check the weighted one against.
  • This replaces the original rule, which gave all the time to the section crossing a reading line about 40% down the viewport. No study we found uses a line, and it counted nothing for a section just off the line, such as the bottom line on a forecast that hasn't been scrolled. The sources and limits are in docs/reading-time.md in the widgets repo.
  • Timers run only while the document is visible.
  • Timers pause after 60 seconds with no scroll, pointer, touch or key input.
  • The Weather tab's content counts toward seconds_weather. Observations, Avalanches and custom tabs count toward no section.
Property Value
view_id Random id for one forecast view
zone, page_type Same values as forecast_viewed
product_id AFP product id
seconds_bottom_line, seconds_danger, seconds_problems, seconds_discussion, seconds_media, seconds_weather The section's attention-weighted share of the time since the last send, in whole seconds
visible_seconds_<section> For the same six sections: whole seconds the section was on screen at all since the last send. Sections on screen together each get the full time.
words_bottom_line, words_problems, words_discussion Word count of the section's text. Same value on every send for a view.
media_seen_image, media_seen_photo, media_seen_video, media_seen_external, media_seen_pdf Items newly scrolled into view since the last send
last_section bottom_line, danger, problems, discussion, media or weather
seconds_away Whole seconds the page was hidden since the last send. 0 on a view's first send.
paragraphs_<section>, bold_<section>, headings_<section>, list_items_<section> For bottom_line, problems and discussion: counts of <p>, <strong>/<b>, <h1>–<h6> and <li> in the section's authored HTML. Same value on every send for a view.
Forecast context See below
Forecast context (on forecast_viewed and forecast_read)

Computed once per view from the product the widget already loaded, and attached to both events. Same value on every send for a view.

Property Value
danger_upper, danger_middle, danger_lower Today's AFP danger level for each elevation band (1–5). Omitted when not rated.
danger_max Highest of the three. Omitted when none is rated.
problem_count Number of avalanche problems
has_<problem> true for each problem type present, using the AFP problem name in snake case, e.g. has_wind_slab, has_persistent_slab. Omitted for types not present.
media_count Media items in the forecast, across all sections
hours_since_published Whole hours from the product's published time to the start of the view
forecast_tab_changed (new)

tab (forecast, weather, observations, avalanches, or the custom tab id), zone. Fires when a reader selects a tab, not on initial load.

forecast_link_clicked (new)

href, section, zone. One delegated click listener per authored-HTML container. Excludes glossary terms and media triggers.

media_opened (more properties)

Adds media_type (the AFP type: image, photo, video, external, pdf, unknown), media_id (the AFP id when present, otherwise the image URL or video id), and caption_length (characters of text with HTML removed, 0 when there's no caption).

media_viewed (new)

media_type, media_id, caption_length, seconds_viewed, from. Fires when a lightbox slide stops being shown: slide change, close, or page hidden. Time pauses while the page is hidden.

observation_opened (more properties)
Property Sent on Value
display Every from modal or full_page
observer_type from: list, forecast_tab AFP value as is: forecaster, observer, intern, educator, public, professional
has_media from: list, forecast_tab Boolean
seconds_on_list from: list Seconds since the list was shown, or since the last modal closed
list_position from: list 1-based position across pages
has_avalanches Every from true when instability.avalanches_observed, avalanches_triggered or avalanches_caught is true, or the observation has avalanche records. On map opens, from the tile's avalanches_observed.
has_cracking, has_collapsing Every from instability.cracking and instability.collapsing. On map opens, from the tile properties of the same names.

The list REST response (/observation/list/), the forecast tab's GraphQL query and the map's vector tiles all carry these fields today. For from: route, read them from the loaded observation.

from says where the open started. $pathname gives the host page. observation_full_page_opened remains the click on "open full page" inside a modal. A modal click also produces a route event, so count opens from one from family, as docs/analytics-events.md already notes.

observation_read (new)

The observation counterpart to forecast_read, using the same section timer and send rules. Answers "which parts of an observation do people read?" for observers deciding where to spend their time.

A view is one observation shown once, in a modal or as a full page, in one page lifetime. It ends when the observation closes, another one opens, or the page unloads. Sends follow forecast_read: on hidden, on close or navigation, and on unmount, with deltas under one view_id.

Property Value
view_id Random id for one observation view
observation_id, observer_type, display As on observation_opened
seconds_summary, seconds_media, seconds_avalanches, seconds_weather, seconds_snowpack, seconds_problems The section's attention-weighted share of the time since the last send, in whole seconds, as on forecast_read. Matches the single-view sections in ObsSingleView.vue.
visible_seconds_<section> For the same sections, as on forecast_read
words_<section>, paragraphs_<section>, bold_<section>, headings_<section>, list_items_<section> For each section with authored text. Counted the same way as on forecast_read. Omitted when the section is absent.
sections_present Comma-separated list of the sections this observation shows, so analysis can compare time only across observations that include a section
last_section, seconds_away As on forecast_read
forecast_zone_clicked (more properties)

Adds zone_center from the zone's center_id. For observation map opens, add the observation's center too if the vector tiles carry it.

Questions answered without new events

  • Who, where from, pageviews, referrers, device split: Web Analytics
  • Moving between products, non-adjacent elements: Paths. On WordPress sites, PostHog only sees pages that contain a widget.
  • Info bubbles, glossary terms and danger controls, including on phones: info_popover_opened, glossary_term_opened, danger_scale_toggled and danger_rose_toggled compared with forecast_viewed, split by device
  • Map vs list: from on observation_opened
  • "Navigation issue or not useful": sampled session replay, AvyWeb only

Not this season

  • User groups and demographics (motorized users, etc.). This waits for user accounts. A one-question prompt saved in the browser was considered and rejected for this season: it gives a partial answer for a visible change on every center's site.
Lingua principale
TypeScript
Stelle
6
Fork
2
Merge medio
1g 11h
PR unite (30g)
35

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

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 NWACus/web

Tutte le issue di NWACus/web

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.