gaAddons - Google Analytics Addons
by Stéphane Hamel
gaAddons brings several enhancements and seemlesly integrates with your existing Google Analytics async tracking code snippet. Each gaAddons call comes with pre-configured default options which can be overwritten using the same flexible tracking syntax found in Google Analytics async calls..
Get started with the snippet integration instructions shown bellow and refer to the calls reference to make the best use of gaAddons.
Refer to the Getting Started with the Asynchronous Snippet for your regular Google Analytics implementation guidelines.
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(
['_setAccount', 'UA-XXXXX-X'],
['_trackPageview']
);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
Save a copy of gaAddons-2.1.2.min.js to your own website.
Note: in theory you could link directly to the file on this site but this would create an unnecessary cross-site dependency and potential vulnerability.
gaAddons is dependent on the jQuery 1.4.4 library. If your site already use it or use an older version gaAddons will work fine.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"> </script>
Integrate the gaAddons calls directly into your standard _gaq code snippet. The resulting JavaScript block looks like this:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="/path-to-your-scripts/gaAddons-2.1.1.min.js"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(
['_setAccount', 'UA-XXXXX-X'],
['_trackDownload'], // This is where gaAddons calls go
['_trackOutbound'], // Showing three basic calls
['_trackMailTo', { // Sample call overwritting some defaults
onBounce:false, // - Do not track if the page is a bounce
category:'email' // - Change the event label
}],
['_trackPageview']
);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
Refer to the calls reference to learn how to properly add gaAddons calls, customize them if needed and see examples.
You should never alter the gaAddons-2.1.1.min.js file itself. If you think there is a bug or a feature is missing, please submit your idea, question, problem or send in your praise about gaAddons through Get Satisfaction!