webperf-snippets icon indicating copy to clipboard operation
webperf-snippets copied to clipboard

Log wrong interactions.

Open szczepanb opened this issue 1 year ago • 2 comments

https://github.com/nucliweb/webperf-snippets/blob/080be73765c85975fb0ba1c063d0f94a19e506fd/pages/Interaction/Interactions.mdx#L26

Please check the snippet for interaction:

I see that this snippet logs interaction only with interactionId = 0, and it seems to be wrong, according to documentation and example here: https://web.dev/articles/diagnose-slow-interactions-in-the-lab?hl=pl#use_a_javascript_snippet

We should log with interactionId > 0.

szczepanb avatar Nov 12 '23 20:11 szczepanb

This line:

.filter((entry) => !entry.interactionId)) { 

It's the same that this line:

if (!entry.interactionId) continue;

nucliweb avatar Nov 12 '23 20:11 nucliweb

Yes,

But You filter interactions with interactionID = 0. It gets only interaction without ID. The documentation says that only interactions with ID are made by user

if (!entry.interactionId) continue;

Here, We are in for loop, when interactionID is 0 they continue and don't log this interaction.

When I use snippets from web.dev and Your at the same time, I see logs in console only from snippet from web.dev.

szczepanb avatar Nov 13 '23 06:11 szczepanb