Commit 41a3d62a authored by Daisuke Akatsuka's avatar Daisuke Akatsuka
Browse files

Bug 1787961: Add telemetry for number of sponsored visit that can not find triggering URL. r=mak

parent bb88ae71
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ const { XPCOMUtils } = ChromeUtils.import(
XPCOMUtils.defineLazyModuleGetters(this, {
  NewTabUtils: "resource://gre/modules/NewTabUtils.jsm",
  PlacesTestUtils: "resource://testing-common/PlacesTestUtils.jsm",
  TelemetryTestUtils: "resource://testing-common/TelemetryTestUtils.jsm",
  UrlbarTestUtils: "resource://testing-common/UrlbarTestUtils.jsm",
});

@@ -910,6 +911,8 @@ add_task(async function fixup() {

add_task(async function noTriggeringURL() {
  await BrowserTestUtils.withNewTab("about:home", async browser => {
    Services.telemetry.clearScalars();

    const dummyTriggeringSponsoredURL =
      "http://example.com/dummyTriggeringSponsoredURL";
    const targetURL = "http://example.com/";
@@ -941,6 +944,14 @@ add_task(async function noTriggeringURL() {
      },
    });

    info("Check telemetry");
    const scalars = TelemetryTestUtils.getProcessScalars("parent", false, true);
    TelemetryTestUtils.assertScalar(
      scalars,
      "places.sponsored_visit_no_triggering_url",
      1
    );

    await clearHistoryAndBookmarks();
  });
});
+10 −0
Original line number Diff line number Diff line
@@ -354,6 +354,16 @@ urlbar.tabtosearch.*
    Due to the potentially sensitive nature of these data, they are currently
    collected only on pre-release version of Firefox. See bug 1686330.

places.*
  This is places related telemetry.

  Valid result types are:

  - ``sponsored_visit_no_triggering_url``
    Number of sponsored visits that could not find their triggering URL in
    history. We expect this to be a small number just due to the navigation layer
    manipulating URLs. A large or growing value may be a concern.

Event Telemetry
---------------

+3 −0
Original line number Diff line number Diff line
@@ -1262,6 +1262,9 @@ class InsertVisitedURIs final : public Runnable {
    if (exists) {
      rv = stmt->GetInt64(0, &aPlace.triggeringPlaceId);
      NS_ENSURE_SUCCESS(rv, rv);
    } else {
      Telemetry::ScalarAdd(
          Telemetry::ScalarID::PLACES_SPONSORED_VISIT_NO_TRIGGERING_URL, 1);
    }

    aPlace.source = nsINavHistoryService::VISIT_SOURCE_SPONSORED;
+19 −0
Original line number Diff line number Diff line
@@ -8616,6 +8616,25 @@ opaque.response.blocking:
      - 'main'
    release_channel_collection: opt-out

places:
  sponsored_visit_no_triggering_url:
    bug_numbers:
      - 1787961
    description: >
      Number of sponsored visits that could not find their triggering URL in
      history. We expect this to be a small number just due to the navigation
      layer manipulating URLs. A large or growing value may be a concern.

    expires: never
    kind: uint
    notification_emails:
      - fx-search-telemetry@mozilla.com
    release_channel_collection: opt-out
    products:
      - 'firefox'
    record_in_processes:
      - main

# NOTE: Please don't add new definitions below this point. Consider adding
# them earlier in the file and leave the telemetry.test category as the last
# one for readability.