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 GA4 fields to match documentation #3679

Merged
merged 2 commits into from
Jun 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/static/js/send-web-vitals.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function sendWebVitals() {
}));
}

function sendWebVitalsGAEvents({name, delta, id, attribution, navigationType}) {
function sendWebVitalsGAEvents({name, delta, value, id, attribution, navigationType}) {

let overrides = {};

Expand Down Expand Up @@ -136,6 +136,11 @@ function sendWebVitals() {
event_category: 'Web Vitals',
value: Math.round(name === 'CLS' ? delta * 1000 : delta),
event_label: id,
// Repeat with new fields to match web-vitals documentation
// TODO deprecate above names when no longer required
metric_value: Math.round(name === 'CLS' ? value * 1000 : value),
metric_delta: Math.round(name === 'CLS' ? delta * 1000 : delta),
metric_id: id,
non_interaction: true,
effective_type: effectiveType,
data_saver: dataSaver,
Expand Down
Loading