Skip to content

Commit

Permalink
Update web vitals (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
rviscomi authored Jan 28, 2024
1 parent d676e39 commit 93a24b6
Show file tree
Hide file tree
Showing 6 changed files with 994 additions and 1,020 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Web Vitals",
"version": "1.4.0",
"version": "1.4.1",
"manifest_version": 3,
"description": "Measure metrics for a healthy site",
"homepage_url": "https://web.dev/vitals/",
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "web-vitals-extension",
"version": "1.4.0",
"version": "1.4.1",
"description": "Instant Web Vitals metrics",
"main": "src/browser_action/vitals.js",
"repository": "https://github.com/googlechrome/web-vitals-extension",
Expand All @@ -21,6 +21,6 @@
"eslint-config-google": "^0.14.0"
},
"dependencies": {
"web-vitals": "^3.4.0"
"web-vitals": "^3.5.2"
}
}
10 changes: 9 additions & 1 deletion src/browser_action/vitals.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,15 @@
metric.attribution.eventEntry) {
const subPartString = `${metric.name} sub-part`;
const eventEntry = metric.attribution.eventEntry;
console.log('Interaction target:', eventEntry.target);

let eventTarget = eventEntry.target;
// Sometimes the eventEntry has no target, so we need to hunt it out manually.
// As of [email protected] `attribution.eventTarget` does the same thing,
// but we want a reference to the element itself (for logging), not a selector.
if (!eventTarget) {
eventTarget = metric.entries.find(entry => entry.target)?.target;
}
console.log('Interaction target:', eventTarget);

for (let entry of metric.entries) {
console.log(`Interaction event type: %c${entry.name}`, 'font-family: monospace');
Expand Down
2 changes: 1 addition & 1 deletion src/browser_action/web-vitals.js

Large diffs are not rendered by default.

Loading

0 comments on commit 93a24b6

Please sign in to comment.