Analytics
Lightweight analytics abstraction layer for tracking page views, custom events
by DavidWellsFree
Domain Rating
by Ahrefs
Domain Rating by Ahrefs54
Description
Analytics is a small open source JavaScript library that gives you one API for tracking page views, custom events and visitor identities, whether you run it in the browser or on Node.js. Instead of calling each analytics service directly, you load the plugins for the tools you use, such as Google Analytics or Customer.io, and the library sends each call to all of them. Adding or removing a tool is a change to the list of plugins, which keeps the rest of your code the same. The library queues events until the analytics tools have loaded, works offline, and includes lifecycle hooks where you can change tracking calls or add behavior. It also has a debug mode and a time-travel style testing aid. The project's guiding principles include respecting visitor privacy settings and offering opt-out mechanisms. You can write your own plugin, for example to send events to your own collection endpoint, using a plain object with named handlers. The package is installed from npm, or loaded from a CDN as a script. The site has an API reference, tutorials and a list of frequently asked questions, and the package is about 13 kB minified and gzipped in its core form.…
Highlights
- One API for page, track and identify calls
- Plugins for third-party analytics tools
- Works in the browser and on Node.js
- Queues events until tools load and works offline
- Lifecycle hooks and debug mode
Ratings & Reviews
No ratings yet
Be the first to rate Analytics.
People also visit

Snowplow Javascript Tracker
Snowplow event tracker for client-side and server-side JavaScript
Analytics FAQ
What is the analytics library?
It is an open source abstraction layer for tracking page views, custom events and visitors, so your app does not depend on one analytics tool.
Do I need a plugin?
No. It works without plugins, but the page, track and identify calls will not send data anywhere until you attach one. You can also write an inline plugin that sends data to your own endpoint.
How big is it?
The core package is about 13.2 kB minified and gzipped, and it adds little if you do not persist data in localStorage.
How do I install it?
Run npm install analytics, or load the script from a CDN, then initialize it and add the plugins for your tools.
Does it respect privacy settings?
The project says respecting visitor privacy settings and offering opt-out mechanisms is one of its principles.
Is it free?
Yes. It is an open source library, and its code is on GitHub.
What are the best Analytics alternatives?
Popular alternatives to Analytics include Snowplow Javascript Tracker, Plausible and Litlyx. See all Analytics alternatives

.png?auto=compress&fit=max&w=128)

