A Google Analytics Painless Javascript Library

GAP.js helps you write one single code that supports both versions of Google Analytics, the classic "ga.js" and universal analytics (analytics.js) and makes realtime javascript error tracking easy as pie!


Try it yourself!

  1. Just add the parameter UA=YOUR_GA_ACCOUNT_ID to this url and also universal=1 (if you are using universal GA) and reload the page.
    For Example {{THIS_URL}}?UA=123312333-1&universal=1
  2. Then login to your analytics account, go to Reports => Realtime => Events, then play with the buttons below and see the magic!
Trigger Event Break it all! Look at the JS console and see what happens!

It solves the following problems

Single code for both versions.

It doesn't matter which version of google analytics you are using (classic or universal). Just use only one syntax and it will work with both of them!

Error tracking for dummies

This is cross-browser implementatio without any library required that allows you to track realtime javascript errors getting some information like the error message, file and line.

Event tracking made easy

You can use data attributes to set the category, action, label and value of the event if you want, but you can trigger with custom values too!

Social Tracking

Track social interactions like tweets, follows, facebook likes and some others with just one line of code! (#truestory!)