amp.dev icon indicating copy to clipboard operation
amp.dev copied to clipboard

CLS collected from AMP via Google Analytics (Universal Analytics) missing data

Open AndrewKGuan opened this issue 3 years ago • 3 comments

When collecting CWVs on AMP following this example, some floating points seem to be incompatible with either/both Universal Analytics (GA) or/and BigQuery. CLS seems to be the most affected metric due to the nature of the values reported by the underlying web_vitals.js. The majority of the data with decimal points seems to be treated as Null when they are being exported to BigQuery from GA, they could also have been truncated when GA is receiving the pings from the page.

Similar application of web_vitals.js under a non-AMP situation when GA4 is used (built-in CWV template) seems to work around the issue by multiplying the values by 1000 so that the portion after decimal point is preserved.

AndrewKGuan avatar May 11 '21 17:05 AndrewKGuan

Related to https://github.com/ampproject/amp.dev/issues/5570

This can be done in AMP via $CALC(${cumulativeLayoutShift}, 1000, multiply).

micajuine-ho avatar May 12 '21 13:05 micajuine-ho

thanks for the fix, @micajuine-ho! I moved the issue over to the site so we can track the docs being updated

patrickkettner avatar May 12 '21 14:05 patrickkettner

Thanks Micajuine! Do publishers need to apply this to other metrics such as LCP as well?

AndrewKGuan avatar May 12 '21 15:05 AndrewKGuan