Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add browser-plugin-web-vitals to track Web Vitals metrics #1190

Merged
merged 1 commit into from
Jun 19, 2023

Conversation

igneel64
Copy link
Contributor

Add a new Web Vitals plugin!

close #1189

@snowplowcla snowplowcla added the cla:yes [Auto generated] Snowplow Contributor License Agreement has been signed. label May 16, 2023
@igneel64 igneel64 force-pushed the feature/1189-browser-plugin-web-vitals branch from f61254a to e233ea6 Compare May 16, 2023 09:20
@bundlemon
Copy link

bundlemon bot commented May 16, 2023

BundleMon

Files added (6)
Status Path Size Limits
libraries/browser-tracker-core/dist/index.mod
ule.js
+24.88KB 25KB / +10%
trackers/javascript-tracker/dist/sp.js
+24.02KB 25KB / +10%
trackers/javascript-tracker/dist/sp.lite.js
+14.69KB 15KB / +10%
trackers/browser-tracker/dist/index.umd.min.j
s
+14.53KB 15KB / +10%
libraries/tracker-core/dist/index.module.js
+13.35KB 15KB / +10%
trackers/browser-tracker/dist/index.module.js
+3.46KB 5KB / +10%

Total files change +94.92KB 0%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history

@igneel64 igneel64 force-pushed the feature/1189-browser-plugin-web-vitals branch 2 times, most recently from f6285c4 to d8957fe Compare May 16, 2023 14:58
plugins/browser-plugin-web-vitals/README.md Outdated Show resolved Hide resolved
plugins/browser-plugin-web-vitals/README.md Outdated Show resolved Hide resolved
plugins/browser-plugin-web-vitals/README.md Outdated Show resolved Hide resolved
plugins/browser-plugin-web-vitals/package.json Outdated Show resolved Hide resolved
plugins/browser-plugin-web-vitals/package.json Outdated Show resolved Hide resolved
plugins/browser-plugin-web-vitals/src/index.ts Outdated Show resolved Hide resolved
plugins/browser-plugin-web-vitals/src/index.ts Outdated Show resolved Hide resolved
plugins/browser-plugin-web-vitals/src/types.ts Outdated Show resolved Hide resolved
* @remarks
*/
export function WebVitalsPlugin(pluginOptions: WebVitalsPluginOptions = defaultPluginOptions): BrowserPlugin {
const webVitalsObject: Record<string, unknown> = {};
Copy link
Contributor

@jethron jethron May 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the type of this be more explicit, like at least Record<string, string | number>?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slightly funkier, but probably not worth it:

export type WebVitalsPayload = {
  navigationType: Metric["navigationType"];
} & {
  [f in Lowercase<Metric["name"]>]: Metric["value"];
};

plugins/browser-plugin-web-vitals/src/index.ts Outdated Show resolved Hide resolved
@igneel64 igneel64 force-pushed the feature/1189-browser-plugin-web-vitals branch 5 times, most recently from 5c029d1 to 9706ad2 Compare May 23, 2023 14:06
@igneel64 igneel64 force-pushed the feature/1189-browser-plugin-web-vitals branch from 9706ad2 to ea0556a Compare May 29, 2023 15:14
@igneel64 igneel64 requested a review from jethron May 29, 2023 15:20
Copy link
Contributor

@jethron jethron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks better with multiple trackers now I think. Some minor quibbles but LGTM even without them.

plugins/browser-plugin-web-vitals/README.md Outdated Show resolved Hide resolved
* @remarks
*/
export function WebVitalsPlugin(pluginOptions: WebVitalsPluginOptions = defaultPluginOptions): BrowserPlugin {
const webVitalsObject: Record<string, unknown> = {};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slightly funkier, but probably not worth it:

export type WebVitalsPayload = {
  navigationType: Metric["navigationType"];
} & {
  [f in Lowercase<Metric["name"]>]: Metric["value"];
};

plugins/browser-plugin-web-vitals/src/utils.ts Outdated Show resolved Hide resolved
plugins/browser-plugin-web-vitals/src/utils.ts Outdated Show resolved Hide resolved
@igneel64 igneel64 force-pushed the feature/1189-browser-plugin-web-vitals branch 2 times, most recently from c2a527d to 23ce30e Compare May 30, 2023 07:24
@igneel64 igneel64 changed the base branch from master to release/3.12.0 May 30, 2023 07:30
Copy link
Contributor

@matus-tomlein matus-tomlein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

plugins/browser-plugin-web-vitals/package.json Outdated Show resolved Hide resolved
plugins/browser-plugin-web-vitals/package.json Outdated Show resolved Hide resolved
plugins/browser-plugin-web-vitals/src/utils.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@matus-tomlein matus-tomlein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@igneel64 igneel64 force-pushed the feature/1189-browser-plugin-web-vitals branch from 23ce30e to d474283 Compare May 31, 2023 13:50
Base automatically changed from release/3.12.0 to master June 5, 2023 11:43
@igneel64 igneel64 changed the base branch from master to release/3.13.0 June 12, 2023 15:30
@igneel64 igneel64 force-pushed the feature/1189-browser-plugin-web-vitals branch from d474283 to 6aa80b8 Compare June 19, 2023 20:35
@igneel64 igneel64 merged commit 7a33f68 into release/3.13.0 Jun 19, 2023
3 checks passed
@igneel64 igneel64 deleted the feature/1189-browser-plugin-web-vitals branch June 19, 2023 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla:yes [Auto generated] Snowplow Contributor License Agreement has been signed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add plugin to track web vitals
4 participants