finds.dev← search

// the find

toddmotto/flare

★ 504 · JavaScript · NOASSERTION · updated Dec 2017

Unobtrusive event emitter API for Google Universal Analytics event tracking

A sub-1KB wrapper around Google Universal Analytics that lets you fire GA events via `data-*` attributes or a JS API instead of calling `ga()` directly. It's a small convenience layer for teams who want to keep tracking config in HTML rather than scattered through JS handlers. Last touched in 2017.

- Genuinely tiny — the data-attribute approach keeps event tracking declarative and out of your JS logic, which is a reasonable pattern for simple sites

- Supports custom events beyond click via `data-flare-event`, so you're not locked into one interaction type

- Has actual unit tests and a CI setup, which was more than most micro-libs bothered with in 2014

- Google Universal Analytics was sunset in July 2023 — GA4 uses a completely different API (`gtag()` / `dataLayer.push()`), so this library is dead on arrival for any new project

- No ESM or modern module format; Bower as a distribution channel should tell you everything about the era this was built for

- Event delegation is not implemented — it binds listeners per element at init time, so dynamically added nodes are silently ignored

- Zero configurability around timing or batching; if `ga()` hasn't loaded yet when the page fires a click, the event is just dropped

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →