Closed Bug 1259507 Opened 8 years ago Closed 8 years ago

Add UI Telemetry probes for WebPush in Fennec

Categories

(Firefox for Android Graveyard :: Metrics, defect)

defect
Not set
normal

Tracking

(firefox48 fixed)

RESOLVED FIXED
Firefox 48
Tracking Status
firefox48 --- fixed

People

(Reporter: nalexander, Assigned: nalexander)

References

Details

Attachments

(1 file)

We have histograms telemetry from the Gecko engine around Web Notifications (WEB_NOTIFICATION_*) and WebPush delivery (PUSH_API_*).  It's not easy to tie either of these to Fennec's retention data.  It's much easier to do that using UI Telemetry.

This ticket tracks adding UI Telemetry events to the Fennec WebPush implementation.
This allows to determine for each user the difference

{# sites subscribed to} - {# sites unsubscribed from}.

If we assume the same site is not frequently subscribed to multiple
times, this is a good approximation to the total number of sites the
user receives Push notifications from.

To test manually:

0) Install Fennec and execute |adb shell setprop log.tag.Telemetry DEBUG|.

1) Subscribe to notifications on a site like serviceworke.rs.

Observe a UI Telemetry PUSH_SUBSCRIBED_TO_SITE event, like:
D/Telemetry( 7109): SendUIEvent: event = push.subscribedtosite.1 method = null timestamp = 277456 extras = null

2) Send a push notification using the sites' interface.

Observe a UI Telemetry PUSH_RECEIVED_MESSAGE event, like:
D/Telemetry( 7109): SendUIEvent: event = push.receivedmessage.1 method = null timestamp = 361795 extras = null

3) Unsubscribe to notifications by revoking permission using Site
Settings from the URL bar.

Observe a UI Telemetry PUSH_UNSUBSCRIBED_FROM_SITE event, like:
D/Telemetry( 7109): SendUIEvent: event = push.unsubscribedfromsite.1 method = null timestamp = 393600 extras = null

Review commit: https://reviewboard.mozilla.org/r/43035/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/43035/
Attachment #8735982 - Flags: review?(mark.finkle)
Comment on attachment 8735982 [details]
MozReview Request: Bug 1259507 - Add UI Telemetry probes for DOM Push API in Fennec. r?mfinkle

https://reviewboard.mozilla.org/r/43035/#review39825

In general, we do not want to make a lot of event types. In fact, we should remove/coalesce some of our existing event types.

::: mobile/android/base/java/org/mozilla/gecko/TelemetryContract.java:76
(Diff revision 1)
>          POLICY_NOTIFICATION_SUCCESS("policynotification.success.1"),
>  
> +        // Received a Push API message from a site.  In the future, we may receive messages from
> +        // non-Push API, Fennec-specific services like Firefox Accounts or Sync, and we will
> +        // track those separately.
> +        PUSH_RECEIVED_MESSAGE("push.receivedmessage.1"),

Still thinking about this one. I might suggest (ACTION, SERVICE, "push" or "content_push") for this one

::: mobile/android/base/java/org/mozilla/gecko/TelemetryContract.java:79
(Diff revision 1)
> +        // non-Push API, Fennec-specific services like Firefox Accounts or Sync, and we will
> +        // track those separately.
> +        PUSH_RECEIVED_MESSAGE("push.receivedmessage.1"),
> +
> +        // Subscribed to Push API messages from a site.
> +        PUSH_SUBSCRIBED_TO_SITE("push.subscribedtosite.1"),

Let's use SAVE

::: mobile/android/base/java/org/mozilla/gecko/TelemetryContract.java:82
(Diff revision 1)
> +
> +        // Subscribed to Push API messages from a site.
> +        PUSH_SUBSCRIBED_TO_SITE("push.subscribedtosite.1"),
> +
> +        // Unsubscribed from Push API messages from a site.
> +        PUSH_UNSUBSCRIBED_FROM_SITE("push.unsubscribedfromsite.1"),

Let's use UNSAVE

::: mobile/android/base/java/org/mozilla/gecko/push/PushService.java:293
(Diff revision 1)
>                      Log.e(LOG_TAG, "Got exception in " + event, e);
>                      callback.sendError("Got exception handling message [" + event + "]: " + e.toString());
>                      return;
>                  }
> +
> +                Telemetry.sendUIEvent(TelemetryContract.Event.PUSH_SUBSCRIBED_TO_SITE);

(SAVE, SERVICE, "push" or "content_push")

::: mobile/android/base/java/org/mozilla/gecko/push/PushService.java:298
(Diff revision 1)
> +                Telemetry.sendUIEvent(TelemetryContract.Event.PUSH_SUBSCRIBED_TO_SITE);
>                  callback.sendSuccess(json);
>                  return;
>              }
>              if ("PushServiceAndroidGCM:UnsubscribeChannel".equals(event)) {
> +                Telemetry.sendUIEvent(TelemetryContract.Event.PUSH_UNSUBSCRIBED_FROM_SITE);

(UNSAVE, SERVICE, "push" or "content_push")

::: mobile/android/docs/uitelemetry.rst:164
(Diff revision 1)
>  ``sanitize.1``
>    Sent when the user chooses to clear private data.
>  
> -``save.1`` ``unsave.1``
> +``save.1``, ``unsave.1``
>    Saving or unsaving a resource (reader, bookmark, etc.) for viewing later.
>    Note: Only used in JavaScript for now.

We could remove this note since these are used in Java too
Attachment #8735982 - Flags: review?(mark.finkle)
Comment on attachment 8735982 [details]
MozReview Request: Bug 1259507 - Add UI Telemetry probes for DOM Push API in Fennec. r?mfinkle

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/43035/diff/1-2/
Attachment #8735982 - Attachment description: MozReview Request: Bug 1259507 - Add UI Telemetry probes for Push API in Fennec. r?mfinkle → MozReview Request: Bug 1259507 - Add UI Telemetry probes for DOM Push API in Fennec. r?mfinkle
Attachment #8735982 - Flags: review?(mark.finkle)
Comment on attachment 8735982 [details]
MozReview Request: Bug 1259507 - Add UI Telemetry probes for DOM Push API in Fennec. r?mfinkle

https://reviewboard.mozilla.org/r/43035/#review39929
Attachment #8735982 - Flags: review?(mark.finkle) → review+
https://hg.mozilla.org/mozilla-central/rev/230a0a44d087
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 48
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.