1
0 Comments

Show IH: Minimal Google Analytics Snippet

https://minimalanalytics.com

Hi Indie Hackers! 👋

wanted to share this with you too, after getting a lot of positive feedback on HN (https://news.ycombinator.com/item?id=18673928) and PH (https://www.producthunt.com/posts/minimal-google-analytics-snippet)

🤔 Problem
The problem is, that I have to add the Google Tag Manager and Analytics libraries to my websites, even if I just want to track basic page views.
The GTM and Analytics libraries are not only huge (72kB together), but also add two additional requests to my websites. Sometimes it would even slow my website down by over 1 second (mainly caused by GTM).

🛠 Solution
As a solution I created this simple snippet I can just add to the HTML of my websites and it's working instantly. It even works for single page applications that have no real page reload, for example applications made with React or Vue.js.
It sends page views directly to the Google Analytics API, without the need to add all the extra clutter.

Please let me know what you think!