Due to Google’s announcement that they will force us to move away from Universal Analytics to Google Analytics 4 I wasn’t happy with that. Due to a lack of alternatives in minimal analytics, loading official (bloated) tracking code that weights 171kB (in my instance), that is liable for blocking by various AdBlockers, wasn’t something that I had been looking forward to.
I started searching for a solution. Due to lack of it, I decided, by hit-and-miss approach, to create my own, and I think I did it. It weighs 2kB minified. Its main purpose is to track page views (
first_visit) on our website in Google Analytics 4 property. Since version 1.06 it detects and tracks site searches (
view_search_results), from 1.07 search query (
search_term) and 1.09 scrolls (
scroll) capturing scroll events each time when a visitor gets to the bottom of a page (90% and below).