Page MenuHomePhabricator

Android widget usage metrics implementation
Closed, ResolvedPublic

Description

We currently do not measure widget engagement and wanted to initiate a strategy to get usage data from this feature. Requesting engineering look into how we can answer some data questions about Search and Featured Article widgets. Starting the discussion on what we can measure here.

Must Have:

  • Instrument widgets so that we know which widgets are opening the app and how many times

Nice to Have

  • Which widgets are installed on devices currently and how many devices have them installed

Event Timeline

Opening of the app from widgets will be instrumented as follows:

Our "breadcrumbs" instrumentation automatically provides an event whenever a certain screen is shown. This will now be augmented with the "source" from which the screen was shown. For example, when the Search screen is shown, currently it sends an event of SearchActivity.SearchFragment.show. This will now be updated to include the invocation source, such as SearchActivity.SearchFragment.show.from.widget, or indeed other sources like SearchActivity.SearchFragment.show.from.toolbar, etc.

And so, to measure incoming clicks from the Search widget, we can now look for these events:
SearchActivity.SearchFragment.show.from.widget

And to measure incoming clicks from the Featured Article widget, we can look for these events:
PageActivity.show.from.widget


  • Which widgets are installed on devices currently and how many devices have them installed

This, OTOH, cannot be instrumented reliably.

Verifying I am seeing 'show.from.widget' events for both Search and AOTD from Beta version 2.7.50469-beta-2024-02-06.

daten_aotd_eventsn_aotd_uniquesn_search_widget_eventsn_search_uniques
2024-02-060032
2024-02-0719164824

PRESTO QUERY: (Daily Events and Uniques)

SELECT
SUBSTR(dt, 1, 10) as date,
sum(CASE WHEN screen_name = 'PageActivity' AND action = 'show.from.widget' THEN 1 else 0 end) AS n_aotd_events,
COUNT(DISTINCT CASE WHEN screen_name = 'PageActivity' AND action = 'show.from.widget' THEN app_install_id ELSE NULL END) AS n_aotd_uniques,
sum(CASE WHEN screen_name = 'SearchActivity.SearchFragment' AND action = 'show.from.widget' THEN 1 else 0 end) AS n_search_widget_events,
COUNT(DISTINCT CASE WHEN screen_name = 'SearchActivity.SearchFragment' AND action = 'show.from.widget' THEN app_install_id ELSE NULL END) AS n_search_uniques
FROM event.android_breadcrumbs_event
WHERE YEAR = 2024 AND MONTH >= 01 AND DAY >= 1
AND regexp_like(action,'show.from.widget')
--AND regexp_like(user_agent_map['wmf_app_version'], '-r-')
GROUP BY 1

Validated we are seeing events for event in Prod release using same query above.