Skip to content

Commit

Permalink
Merge pull request #1919 from mozilla/Bug1888430
Browse files Browse the repository at this point in the history
Bug 1888430 - Add `page_id`  to Glean automatic events
  • Loading branch information
travis79 committed Apr 22, 2024
2 parents 67db2df + 096e18f commit c5aa793
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
13 changes: 13 additions & 0 deletions glean/src/core/glean_metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import { Context } from "./context.js";
import UUIDMetric from "./metrics/types/uuid.js";
import EventMetricType from "./metrics/types/event.js";
import { EVENTS_PING_NAME } from "./constants.js";
import { Lifetime } from "./metrics/lifetime.js";
Expand Down Expand Up @@ -51,6 +52,15 @@ namespace GleanMetrics {
},
// extras defined in `src/metrics.yaml`.
["id", "type", "label"]
),
pageId: new UUIDMetric(
{
category: "glean",
name: "page_id",
sendInPings: [EVENTS_PING_NAME],
lifetime: Lifetime.Application,
disabled: false,
}
)
};

Expand All @@ -72,6 +82,9 @@ namespace GleanMetrics {
return;
}

// Rotate the page_id for each page_load event.
metrics.pageId.generateAndSet();

// Each key defaults to the override. If no override is provided, we fall
// back to the default value IF the `window` or the `document` objects
// are available.
Expand Down
17 changes: 17 additions & 0 deletions glean/src/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -539,3 +539,20 @@ glean:
label:
description: The label of the element clicked. For automatic collection, its value is the element's `data-glean-label` data attribute value.
type: string
page_id:
type: uuid
description: |
Uniquely identifies a page_load, not the page itself, for the purpose of associating other events with the specific page load event. This gets
rotated with each page load and is sent along with each event ping.
send_in_pings:
- events
lifetime: application
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1888430
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1888430
data_sensitivity:
- technical
notification_emails:
- glean-team@mozilla.com
expires: never

0 comments on commit c5aa793

Please sign in to comment.