DavidWells/analytics

Lightweight analytics abstraction layer for tracking page views, custom events, & identifying visitors

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 38 minutes ago
Added to GitGenius on January 22nd, 2023
Created on October 24th, 2018
Open Issues & Pull Requests: 112 (+0)
Number of forks: 266
Total Stargazers: 2,663 (+0)
Total Subscribers: 24 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 9.6 days
Mean response time: 316.5 days
90th percentile: 1124.8 days
Tracked items: 58

How this project is maintained

Around half of the issues opened in the past year never receive a reply. 71% of open issues come from outside the core team, so the backlog reflects real-world use rather than internal planning. Only 2% of issues opened in the past year have been closed. Three people close 100% of everything that gets resolved.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 28
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 789 days
Stale 30+ days: 28
Stale 90+ days: 25

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

  • auto-generated (18)
  • claude-code (18)
  • Plugin Request (2)
  • ci-cd (1)
  • documentation (1)
  • good first issue (1)
  • help wanted (1)

Most active issues this week

No issue events were indexed in the last 7 days.

Detailed Description

The analytics repository is a lightweight JavaScript library that provides an abstraction layer for tracking page views, custom events, and identifying visitors across multiple analytics platforms. Hosted at getanalytics.io, it solves a common problem in web development: companies frequently need to switch between analytics providers or use multiple services simultaneously, which typically requires significant code refactoring. This library eliminates that friction by offering a pluggable architecture where analytics providers are loaded as plugins, making it trivial to add or remove services without touching core application logic.

The core API exposes several key methods for analytics operations. The identify method associates a user with a unique ID and optional traits, triggering identify calls across all installed plugins and persisting user data to localStorage. The track method records custom events with optional payloads and options, firing track calls through all active plugins. The page method triggers page view tracking across plugins. Additional utility methods include user for retrieving user data, reset for clearing visitor information, ready for executing callbacks when all providers load, and on/once for attaching handlers to analytics lifecycle events. The library also provides storage utilities for persisting data via localStorage, cookies, or window storage, and plugin management methods for enabling and disabling specific analytics integrations at runtime.

The library is designed with several architectural advantages. It works isomorphically in both browser and server environments, queues events intelligently to send them when analytic libraries finish loading, supports conditional loading of third-party scripts, and functions offline. It includes built-in debugging capabilities with time travel and offline mode for testing analytics integrations. TypeScript support is available for type-safe implementations. The design philosophy emphasizes developer experience, visitor privacy, and flexibility—users should never feel locked into a specific analytics tool, and the system respects privacy settings with opt-out mechanisms.

The library is distributed via npm and supports multiple installation methods including yarn, pnpm, bun, and script tag inclusion. A live demo application is available at analytics-demo.netlify.app for reference implementation. The documentation is comprehensive, covering configuration options, all API methods with examples, event lifecycle documentation, plugin creation guidelines, and community plugin listings. The repository emphasizes that adding or removing analytics providers requires only adjusting the plugins array during initialization, embodying the core principle that analytics tooling should be a simple configuration concern rather than an architectural constraint.