Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a Event Analytics Abstraction Layer for Javascript?

I was wondering if there was an adapter library for Javascript to make integrating tools like Google Analytics, Kissmetrics, mixpanel, Chartbeat, gaug.es, etc easier. Something like SLF4J, but for event tracking. We are evaluating different tools, and it seems like it would be useful if it was possible to quickly swap between them.

like image 993
JBCP Avatar asked Mar 13 '12 02:03

JBCP


People also ask

How does Google Analytics work with JavaScript?

But importantly for Google Analytics, JavaScript allows your computer to send and receive messages to other computers connected to the internet. When you visit a site that has implemented Google Analytics, the site will ask your computer to temporarily download some JavaScript instructions from Google Analytics.

Does Google Analytics rely on JavaScript?

Google Analytics relies on two pieces of browser technology to track website users: cookies, and JavaScript.

How is JavaScript used in Web Analytics?

The JavaScript code executes every time a web page is loaded, irrespective of whether sourced from cache, proxy server or the website's server. The script calls back the website's server and passes the user's information to the server. Call backs are asynchronous, ajax based, so they do not to impair performance.


1 Answers

We recently built analytics.js to solve this problem. It's a javascript wrapper library for Google Analytics, KISSmetrics, Mixpanel, Gauges, Chartbeat, GoSquared, and 16 other services.

The library does pretty much everything you mentioned:

  • Loads all the javascript snippets asynchronously
  • Abstracts the event-views and other API methods across all the libraries
  • And exposes each service's global object in case you need to do something custom

You can check out the open source library on Github: http://segmentio.github.com/analytics.js

Or for an easier solution that also supports the same abstraction on the server-side for Python, Ruby, Node, Java and .NET, check out https://segment.io

like image 196
reinpk Avatar answered Sep 18 '22 15:09

reinpk