SocialGouv / matomo-next

Matomo for Next.js applications
Apache License 2.0
152 stars 21 forks source link

Avoid Total Blocking Time increase #94

Open mhoev opened 1 year ago

mhoev commented 1 year ago

The integration of Matomo into our Next.js site unfortunately increases the Total Blocking Time (TBT) in http://pagespeed.web.dev (mobile) to 300 to 500ms.

We were thinking of two ideas of how to reduce the impact:

  1. Instead of loading matomo.js as a file, integrate its component directly into Next.js as this may avoid redundant code
  2. Reduce the load for the main thread by utilising a web worker as next/script has now (experimental) support for it

Any thoughts on the above?