Hacker News new | ask | show | jobs
Show HN: A tiny (400B) client-side module for tracking with Google Analytics (github.com)
4 points by lukeed 3253 days ago
1 comments

Main takeaways:

- 0.4kb vs 12kb for official client (gzip)

- Respects visitors' `doNotTrack` settings

- Does not ship internal XHR library

- Correlates to the Google docs

- API is 99% familiar, haha

- Well-documented

- Cacheable

It isn't exactly a drop-in replacement, but the tweaks needed are incredibly minor.

The GET requests are made via `new Image()`, which is a low priority network request, so your critical requests won't be blocked or delayed because of a trivial `pageview` analytic.

Internet Explorer is not supported by default; however, it's VERY easy to regain compatibility. `Object.assign` is the only roadblock, which has a Babel quick-fix.

Hope you enjoy! And feel free to ask questions. Thanks!