Summary
Provide a new field from the API endpoint to allow users to specify segmentation. Below would be the diff of the JavaScript example documented here.
const body = JSON.stringify({
accountId: YOUR_ACCOUNT_ID,
name: metric.name,
+ segmentation: ['logged-in', 'premium-subscribed'],
url: window.location.href,
value: metric.value,
});
return (
(navigator.sendBeacon && navigator.sendBeacon(VITALS_URL, body)) ||
fetch(VITALS_URL, {
body,
method: 'POST',
keepalive: true,
headers: {
'Content-Type': 'application/json',
},
})
);
In the Web Vitals dashboard we could present a checklist of all segmentations that have been sent. In the example above, the user would have 3 checkboxes for segmentation: none, logged-in, and premium-subscribed. By default, all 3 would be checked. If only logged-in was checked, we would only show data for metrics that had this value of the segmentation array sent with it.
Value
This would provide users the ability to analyze page experience (Web Vitals) as part of A/B test experiments.
Summary
Provide a new field from the API endpoint to allow users to specify segmentation. Below would be the diff of the JavaScript example documented here.
const body = JSON.stringify({ accountId: YOUR_ACCOUNT_ID, name: metric.name, + segmentation: ['logged-in', 'premium-subscribed'], url: window.location.href, value: metric.value, }); return ( (navigator.sendBeacon && navigator.sendBeacon(VITALS_URL, body)) || fetch(VITALS_URL, { body, method: 'POST', keepalive: true, headers: { 'Content-Type': 'application/json', }, }) );In the Web Vitals dashboard we could present a checklist of all segmentations that have been sent. In the example above, the user would have 3 checkboxes for segmentation:
none,logged-in, andpremium-subscribed. By default, all 3 would be checked. If onlylogged-inwas checked, we would only show data for metrics that had this value of thesegmentationarray sent with it.Value
This would provide users the ability to analyze page experience (Web Vitals) as part of A/B test experiments.