GAWrapper 1.0.0

A MooTools wrapper for Google Analytics web analytics service


Oran Leiba
Current version
GitHub Issues


How to use

GAWrapper Utility is aimed to simplify the use of Google Analytics for MooTools developers.

Current version allows you to track page view and also register click event tracking to better understand how your visitors interact with your site.

The GAWrapper is using the Async usage of Google API.

Simply register for a Google Analytics account (,

Create a website profile and get a profile number UA-XXXXXXXX-X,

Create the wrapper:

var gaWrapper = new GAWrapper('UA-XXXXXXXX-X','',{shouldLog:true,duplicateAsPageView:true});

'' - recommended to avoid conflicts with other trackers on your page and to allow you to run multiple trackers.

If not used, send null.

Options object is optional.

Default options: options: { onLoadTrackPageView:true, /* track page view or not on initial load / pageViewStr:null, / you should start your page name with a leading slash '/' further reading : shouldLog:false, / console logging for firebug / duplicateAsPageView:false, / This will create a 'pageview' for every event registered and fired useful for drill down on Google Analytics online dashboard under "Content->Content Drilldown"/ domainName:null / if you would like the tracking to be limited to a specific domain or sub domain (_setDomainName)*/ },

Two main function to use:

pushPageView() and pushClicked():

pushPageView(str) // use to register a pageview. 'str' is optional and if is not sent or null will use the default _trackPageview by GA.

pushClicked(category, action, opt_label, opt_value) //

A working demo was created on

Please use Firefox with firebug enabled so you can see the logging in the console.

Class is used in production on


A note on comments here: These comments are moderated. No comments will show up until they are approved. Comments that are not productive (i.e. inflammatory, rude, etc) will not be approved.

Found a bug in this plugin? Please report it this repository's Github Issues.

blog comments powered by Disqus