chrisblakley / Nebula

Nebula is a WordPress theme framework that focuses on enhancing development. The core features of Nebula make it a powerful tool for designing, developing, and analyzing WordPress websites consistently, yet its deliberately uncomplicated code syntax also serves as a learning resource for programmers themselves.
https://nebula.gearside.com
GNU General Public License v2.0
139 stars 36 forks source link

Send performance events/metrics to GA4 #2261

Closed chrisblakley closed 11 months ago

chrisblakley commented 11 months ago

GA4 does not have site speed reports or any load time metrics. Since Nebula already detects these, send the data to GA4 as a non-interactive event and make custom metrics for the important load time milestones.

From here, Explore reports could be created to monitor these load times.

chrisblakley commented 11 months ago

Here's how we're calculating it in optimization.js:

Response (TTFB): Math.round(performance.timing.responseStart - performance.timing.navigationStart) Until DOM Ready: Math.round(performance.timing.domComplete - performance.timing.navigationStart) onLoad: Math.round(performance.timing.loadEventStart - performance.timing.navigationStart) Until Fully Loaded: Math.round(performance.timing.loadEventEnd - performance.timing.navigationStart)

chrisblakley commented 11 months ago

These performance timings are actually now deprecated...

This has been updated to use the preferred method of detecting these and are now sent with a non-interactive load_timings event. To use these parameters I recommend the following custom dimensions and metrics:

Custom Dimensions

Custom Metrics: