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.
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.
Google Analytics relies on two pieces of browser technology to track website users: cookies, and JavaScript.
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.
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:
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With