Bug 1692840 - Add "Open a New Tab" at the top of the tabstrip context menu. r=Gijs
[gecko.git] / browser / docs / BrowserUsageTelemetry.rst
blob641e8ef5c97244fee198a0f12c2776f410f1d4aa
1 .. _browserusagetelemetry:
3 =======================
4 Browser Usage Telemetry
5 =======================
7 The `BrowserUsageTelemetry.jsm <https://searchfox.org/mozilla-central/source/browser/modules/BrowserUsageTelemetry.jsm>`_ module is the main module for measurements regarding the browser usage (e.g. tab and window counts, search counts, ...).
9 The measurements recording begins right after the ``SessionStore`` has finished restoring the session (i.e. restoring tabs/windows after Firefox starts).
11 Search telemetry
12 ================
13 This module exposes the ``recordSearch`` method, which serves as the main entry point for recording search related Telemetry. It records only the search *counts* per engine and the origin of the search, but nothing pertaining the search contents themselves.
15 A list of the components recording search Telemetry can be found using the following `Searchfox search <https://searchfox.org/mozilla-central/search?q=recordSearch>`_.
17 Tab and window interactions
18 ===========================
19 The usage telemetry module currently measures these interactions with the browser's tabs and windows:
21 - *tab and window engagement*: counts the number of non-private tabs and windows opened in a subsession, after the session is restored (see e.g. ``browser.engagement.max_concurrent_tab_count``);
22 - *URI loads*: counts the number of page loads (doesn't track and send the addresses, just the counts) directly triggered by the users (see ``browser.engagement.total_uri_count``);
23 - *navigation events*: at this time, this only counts the number of time a page load is triggered by a particular UI interaction (e.g. by searching through the URL bar, see ``browser.engagement.navigation.urlbar``).
26 Please see `Scalars.yaml <https://searchfox.org/mozilla-central/source/toolkit/components/telemetry/Scalars.yaml>`_ for the full list of tracked interactions.
28 Customizable UI
29 ===============
31 This telemetry records information about the positions of toolbar items and when
32 the user interacts with them. It is submitted as scalar values along with the
33 normal telemetry ping. There are a number of different parts to this telemetry:
35 UI Areas
36 --------
38 For the purposes of this telemetry a set of areas are defined:
40 * In the main browser UI:
42   * ``menu-bar`` - The main menu.
43   * ``menu-toolbar`` - The normally hidden toolbar that holds the main menu.
44   * ``titlebar`` - The optional title bar.
45   * ``tabs-bar`` - The area where tabs are displayed.
46   * ``bookmarks-bar`` - The bookmarks toolbar.
47   * ``app-menu`` - The main application (hamburger) menu.
48   * ``tabs-context`` - The context menu shown from right-clicking a tab.
49   * ``content-context`` - The context menu shown from right-clicking the web page.
50   * ``widget-overflow-list`` - Items that have overflowed the available space.
51   * ``pinned-overflow-menu`` - Items that the user has pinned to the toolbar overflow menu.
52   * ``pageaction-urlbar`` - Page actions buttons in the address bar.
53   * ``pageaction-panel`` - The page action (meatball) menu.
54   * ``nav-bar-start`` - The area of the navigation toolbar before the address bar.
55   * ``nav-bar-end`` - The area of the navigastion toolbar after the address bar.
57 * In ``about:preferences`` the different cagtegories are used:
59   * ``preferences-paneGeneral``
60   * ``preferences-paneHome``
61   * ``preferences-panePrivacy``
62   * ``preferences-paneSearch``
63   * ``preferences-paneSearchResults``
64   * ``preferences-paneSync``
65   * ``preferences-paneContainers``
67 Widget Identifiers
68 ------------------
70 In order to uniquely identify a visual element a set of heuristics are used:
72 #. If the element is one of the customizable toolbar items then that item's ID
73    is used.
74 #. If the DOM element has an ID set then that is used.
75 #. If the DOM element's class contains one of ``bookmark-item``,
76    ``tab-icon-sound`` or ``tab-close-button`` then that is used.
77 #. If the DOM element has a ``preference`` ``key``, ``command``, ``observes`` or
78    ``data-l10n-id`` attribute then that is used.
79 #. If there is still no identifier then this is repeated for the DOM element's
80    parent element.
82 Widget Locations
83 ----------------
85 The keyed scalar ``browser.ui.toolbar_widgets`` records the position of widgets in
86 the UI. At startup the positions of widgets are collected and recorded by
87 setting the scalar key ``<widget id>_pinned_<area>`` to true. The widget ID are
88 the IDs of the elements in the DOM. The area is one of the areas listed above
89 from the browser UI that can be customised.
91 For the areas that can be controlled the scalar keys ``<area>_<off/on/newtab>`` are set.
92 ``newtab`` is special to the Bookmarks Toolbar and is used when the toolbar will only
93 be shown on the New Tab page.
95 Widget Customization
96 --------------------
98 The scalar ``browser.ui.customized_widgets`` records whenever the user moves a
99 widget around the toolbars or shows or hides some of the areas. When a change
100 occurs the scalar with the key ``<widget id>_<action>_<old area>_<new area>_<reason>``
101 is incremented. The action can be one of ``move``, ``add`` or ``remove``. Old
102 area and new area are the previous and now locations of the widget. In the case
103 of ``add`` or ``remove`` actions one of the areas will be ``na``. For areas that
104 can be shown or hidden the areas will be ``off`` or ``on``. The reason is a simple
105 string that indicates what caused the move to happen (drag, context menu, etc.).
107 UI Interactions
108 ---------------
110 The scalars ``browser.ui.interaction.<area>`` record how often the use
111 interacts with the browser. The area is one of those above with the addition of
112 ``keyboard`` for keyboard shortcuts.
114 When an interaction occurs the widget's identifier is used as the key and the
115 scalar is incremented. If the widget is provided by an add-on then the add-on
116 identifier is dropped and an identifier of the form ``addonX`` is used where X
117 is a number. The number used is stable for a single session. Everytime the user
118 moves or interacts with an add-on the same number is used but then the numbers
119 for each add-on may change after Firefox has been restarted.
121 Profile Count
122 =============
124 The scalar ``browser.engagement.profile_count`` records how many profiles have
125 been used by the current Firefox installation. It reports a bucketed result,
126 which will be 0 if there is an error. The raw value will be reported for 1-10,
127 but above that, it will report 10 for 10-99, 100 for 100-999, 1000 for
128 1000-9999, and 10000 for any values greater than that.
130 The profile count data for an installation is stored in the root of the
131 update directory in a file called ``profile_count_<install hash>.json``. The
132 full path to the file will typically look something like
133 ``C:\ProgramData\Mozilla\profile_count_5A9E6E2F272F7AA0.json``.
135 This value is meant to be resilient to re-installation, so that file will not
136 be removed when Firefox is uninstalled.