Adding Glean Telemetry Events - my-swift-lab/firefox-ios GitHub Wiki

a) Request Data Review Fill out the following form and request a data review for the event(s). The form can be attached in the same Issue / PR. Best to do it in the Issue as it can take anywhere from few hours to 2 days for the review.

Form: https://github.com/mozilla/data-review/blob/master/review.md

Finally tag one of the following Data Steward

  • Daniela (Preferred)
  • Jeff Boek
  • Chenxia Liu

Sample: https://github.com/mozilla-mobile/firefox-ios/issues/6886

Ref: https://wiki.mozilla.org/Firefox/Data_Collection

b) Changes to be made in the code

  • Update Metrics.yaml: This is used for generating Metrics.swift for glean telemetry
event_name                // Use underscore instead of a dash
  new_tab_pressed:
    type: counter         // String, counter, boolean, labeled_counter
    description: |        // Add appropriate description 
      This place is reserved for description of the event
    bugs:                 // Add link to the issue Ex. github
      - https://github.com/mozilla-mobile/firefox-ios/issues/6886
    data_reviews:         // Add link to where the review got approved
      - https://github.com/mozilla-mobile/firefox-ios/issues/6886
    notification_emails:  // Person responsible for iOS use the email below
      - [email protected]
    expires: "2021-07-21" // How long do we need to track this event. Ex 1yr
  • Run the app so Glean generates Metrics.swift file that can be used to add gleanRecord
  • Update TelemetryWrapper.swift Add: EventCategory | EventMethod | EventObject Update: Add case for the event in func gleanRecordEvent like below
// Start Search Button
    case (.action, .tap, .startSearchButton, _, _):
        GleanMetrics.Search.newTabPressed.add()

Sample: https://github.com/mozilla-mobile/firefox-ios/pull/7023

c) Finally make PR with the apt changes mentioned in a) and b)