Skip to content

Commit 3b2dbb4

Browse files
committed
Merge branch 'release-v5.0.6' into release
2 parents 1b6e44d + 5862f36 commit 3b2dbb4

File tree

9 files changed

+55
-20
lines changed

9 files changed

+55
-20
lines changed

CHANGELOG.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
11
# Unreleased changes
22

3-
[Full changelog](https://github.com/mozilla/glean.js/compare/v5.0.5...main)
3+
[Full changelog](https://github.com/mozilla/glean.js/compare/v5.0.6...main)
44

5-
# v5.0.5 (2025-07-17)
5+
# v5.0.6 (2025-09-15)
66

7-
* [#1993](https://github.com/mozilla/glean.js/pull/1993): Add try-catch around uses of sessionStorage and localStorage in core.
7+
# v5.0.6 (2025-09-15)
8+
9+
[Full changelog](https://github.com/mozilla/glean.js/compare/v5.0.5...v5.0.6)
10+
11+
* [#2010](https://github.com/mozilla/glean.js/pull/2010): Remove faulty check for sessionStorage to prevent uncaught error.
12+
* [#2011](https://github.com/mozilla/glean.js/pull/2011): Bug 1987158 - Capture page `url`/`referrer`/`title` with `recordElementClick()`.
13+
14+
# v5.0.5 (2025-07-17)
815

916
[Full changelog](https://github.com/mozilla/glean.js/compare/v5.0.4...v5.0.5)
1017

11-
# v5.0.4 (2025-04-02)
18+
* [#1993](https://github.com/mozilla/glean.js/pull/1993): Add try-catch around uses of sessionStorage and localStorage in core.
1219

13-
* [#1977](https://github.com/mozilla/glean.js/pull/1977): Add try-catch around window.sessionStorage access to prevent uncaught error upon `import`.
20+
# v5.0.4 (2025-04-02)
1421

1522
[Full changelog](https://github.com/mozilla/glean.js/compare/v5.0.3...v5.0.4)
1623

24+
* [#1977](https://github.com/mozilla/glean.js/pull/1977): Add try-catch around window.sessionStorage access to prevent uncaught error upon `import`.
25+
1726
# v5.0.3 (2024-08-02)
1827

1928
[Full changelog](https://github.com/mozilla/glean.js/compare/v5.0.2...v5.0.3)

docs/reference/metrics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ In addition to those built-in metrics, the following metrics are added to the pi
101101

102102
| Name | Type | Description | Data reviews | Extras | Expiration | [Data Sensitivity](https://wiki.mozilla.org/Firefox/Data_Collection) |
103103
| --- | --- | --- | --- | --- | --- | --- |
104-
| glean.element_click |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A event triggered whenever an html element is clicked on a page. **Clicks are recorded only for those html elements that have at least one of the `data-glean-*` data attributes. By default, this event is not collected automatically. Collection can be turned on by clients via Glean configuration object (`enableAutoElementClickEvents`). Glean also provides a separate API for clients to record element clicks manually.** |[Bug 1867294](https://bugzilla.mozilla.org/show_bug.cgi?id=1867294#c29)|<ul><li>id: An identifier of the element clicked. For automatic collection, its value is the element's `data-glean-id` data attribute value.</li><li>label: The label of the element clicked. For automatic collection, its value is the element's `data-glean-label` data attribute value.</li><li>type: The type of the element clicked. For automatic collection, its value is the element's `data-glean-type` data attribute value.</li></ul>|never |2 |
104+
| glean.element_click |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A event triggered whenever an html element is clicked on a page. **Clicks are recorded only for those html elements that have at least one of the `data-glean-*` data attributes. By default, this event is not collected automatically. Collection can be turned on by clients via Glean configuration object (`enableAutoElementClickEvents`). Glean also provides a separate API for clients to record element clicks manually.** |[Bug 1867294](https://bugzilla.mozilla.org/show_bug.cgi?id=1867294#c29)|<ul><li>id: An identifier of the element clicked. For automatic collection, its value is the element's `data-glean-id` data attribute value.</li><li>label: The label of the element clicked. For automatic collection, its value is the element's `data-glean-label` data attribute value.</li><li>referrer: The referrer of the page where the element was clicked.</li><li>title: The title of the page where the element was clicked.</li><li>type: The type of the element clicked. For automatic collection, its value is the element's `data-glean-type` data attribute value.</li><li>url: The URL of the page where the element was clicked.</li></ul>|never |2 |
105105
| glean.page_id |[uuid](https://mozilla.github.io/glean/book/user/metrics/uuid.html) |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. |[Bug 1888430](https://bugzilla.mozilla.org/show_bug.cgi?id=1888430)||never |1 |
106106
| glean.page_load |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A event triggered whenever a page is loaded. **This event by default is not collected automatically. This can be turned on by the client in the Glean configuration object (`enableAutoPageLoadEvents`). Glean provides a separate API for collecting the same page load data if the client wants to collect page loads manually.** |[Bug 1867126](https://bugzilla.mozilla.org/show_bug.cgi?id=1867126#c8)|<ul><li>referrer: The page referrer.</li><li>title: The page title.</li><li>url: The page URL.</li></ul>|never |2 |
107107

documentation/src/content/docs/automatic_instrumentation/click_events.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ An example HTML button that will fire a click event:
3636
</button>
3737
```
3838

39+
Glean also automatically captures the following values for click events:
40+
41+
- url: `window.location.href`
42+
- referrer: `document.referrer`
43+
- title: `document.title`
44+
3945
## Click event API
4046

4147
Glean.js provides an API for manually collecting click events.

glean/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

glean/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mozilla/glean",
3-
"version": "5.0.5",
3+
"version": "5.0.6",
44
"description": "An implementation of the Glean SDK, a modern cross-platform telemetry client, for JavaScript environments.",
55
"type": "module",
66
"sideEffects": false,

glean/src/core/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const GLEAN_SCHEMA_VERSION = 1;
88
//
99
// PACKAGE_VERSION is defined as a global by webpack,
1010
// we need a default here for testing when the app is not build with webpack.
11-
export const GLEAN_VERSION = "5.0.5";
11+
export const GLEAN_VERSION = "5.0.6";
1212

1313
// The name of a "ping" that will include Glean ping_info metrics,
1414
// such as ping sequence numbers.

glean/src/core/glean.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -194,14 +194,6 @@ namespace Glean {
194194
* Fetch debug options from SessionStorage and set the Glean preInit debug options.
195195
*/
196196
function setDebugOptionsFromSessionStorage() {
197-
// If we cannot access browser APIs, we do nothing.
198-
if (
199-
typeof window === "undefined" ||
200-
typeof window.sessionStorage === "undefined"
201-
) {
202-
return;
203-
}
204-
205197
const logPings = getDebugOptionFromSessionStorage(DebugOption.LogPings);
206198
if (logPings) {
207199
preInitLogPings = extractBooleanFromString(logPings);

glean/src/core/glean_metrics.ts

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ type ElementClickEventContext = {
2121
id?: string;
2222
type?: string;
2323
label?: string;
24+
url?: string;
25+
referrer?: string;
26+
title?: string;
2427
};
2528

2629
/**
@@ -51,7 +54,7 @@ namespace GleanMetrics {
5154
disabled: false,
5255
},
5356
// extras defined in `src/metrics.yaml`.
54-
["id", "type", "label"]
57+
["id", "type", "label", "url", "referrer", "title"]
5558
),
5659
pageId: new UUIDMetric(
5760
{
@@ -124,8 +127,24 @@ namespace GleanMetrics {
124127
const elementClickEventContext: ElementClickEventContext = {
125128
...(dataset.gleanId && { id: dataset.gleanId }),
126129
...(dataset.gleanType && { type: dataset.gleanType }),
127-
...(dataset.gleanLabel && { label: dataset.gleanLabel })
130+
...(dataset.gleanLabel && { label: dataset.gleanLabel }),
131+
url:
132+
(typeof window !== "undefined"
133+
? window.location.href
134+
: "URL_NOT_PROVIDED_OR_AVAILABLE"
135+
),
136+
referrer:
137+
(typeof document !== "undefined"
138+
? document.referrer
139+
: "REFERRER_NOT_PROVIDED_OR_AVAILABLE"
140+
),
141+
title:
142+
(typeof document !== "undefined"
143+
? document.title
144+
: "TITLE_NOT_PROVIDED_OR_AVAILABLE"
145+
),
128146
};
147+
129148
return elementClickEventContext;
130149
}
131150

glean/src/metrics.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,15 @@ glean:
539539
label:
540540
description: The label of the element clicked. For automatic collection, its value is the element's `data-glean-label` data attribute value.
541541
type: string
542+
url:
543+
description: The URL of the page where the element was clicked.
544+
type: string
545+
referrer:
546+
description: The referrer of the page where the element was clicked.
547+
type: string
548+
title:
549+
description: The title of the page where the element was clicked.
550+
type: string
542551
page_id:
543552
type: uuid
544553
description: |

0 commit comments

Comments
 (0)