Home -> Other Cool Stuff -> Joomla Extensions -> GA: Asynchronous

Google Analytics Joomla: Asynchronous Version

 

Did you know you can synchronize your email on multiple computers?

Automatically? And without buying expensive software or paying for subscriptions?

Use your favorite email software and work with your email on any computer!

See how the brilliantly simple Easy-Email solution will make your life easier by watching the quick video Thunderbird Sync.

 

Download

2010-05-18 - Version 1.1 - plg_system_analyticsasynchronous_1.1.zip

2010-03-17 - Version 1.0 - plg_system_analyticsasynchronous_1.0.zip

Background

Google has opened up for a new way of incorporating the Google Analytics code on your web site: Asynchronous loading.chart_xsmall

This means Google Analytics will be loading at the same time as other elements on your web page, therefore not slowing it down.

As a result you can now place the Google Analytics code near the top of your page, which again means that your will get more accurate statistics in Google Analytics. If people navigate away from your page before the page is fully loaded the visit will still register in Goolge Analytics.

Google recommends that you place the asynchronous code just before the closing <head> tag.

Update! Google has changed their recommendations. Before they recommended you added the analytics code just after the opening body tag. Now they recommend you add the code just before the closing head tag.

As an alternative you can split the Analytics code, so part of the code loads at the beginning of the page, and the remaining code is placed just before the </body> tag.

You can find the Google documentation here.

And the documentation for splitting the code is here.

We needed this functionality and could not find a plugin to do this... so we hacked the component here, which was written for Clicktale integration by Joshua Guedalia at Two Tribes.

We thought the plugin could be of use to others so we put it up for download. This web site is not dedicated to Joomla stuff but it was the easiest place for us to put up the component for download.

The plugin is released under the GPL license and you are most welcome to use it as you see fit.

PS If you need to track your outgoing links and file downloads grab our other extension here.

 

Always test a new component in a test environment

before installing on a production server!

Installation

Log in to the admin interface of your Joomla site.

Go to Extensions -> Install/Uninstall.

Browse to the file you downloaded and click Upload File & Install.

Go to Extensions -> Plugin Manager.

Find the plugin System - Analytics Asynchronous.

Click on it to open the settings page.

In the code remember to substitute UA-XXXXX-X with your own Google Analytics code.

Normal use

For normal use you place all the code at the top of the page.

Enter the following code in the Top box:

<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
_gaq.push(['_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';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
})();
</script>

Split code use

If you wish to use split code enter the following in the Top box:

<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
_gaq.push(['_trackPageview']);
</script>

In the Bottom box enter:

<script type="text/javascript">
(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';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
})();
</script>

Enable the plugin

Remember to enable the plugin.

Verify it works

Go to your web site.

View the page source for the page.

You should see the added code just after the <body> tag.

And if you are using the split code the bottom part is added just before the </body> tag.

Page source with split code:

...
</head>
<body>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
_gaq.push(['_trackPageview']);
</script>
...
<script type="text/javascript">
(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';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
})();

</script></body>
...

Customizations

All the tracking code is visible to you, which makes it easy for you to make your own customizations.

Check this page for ideas on how you can extend your Analytics.

Contact

If you have any questions or suggestions please contact us here.

Legal stuff

This business is not affiliated with or endorsed by the Joomla! Project.  It is not supported or warranted by the Joomla! Project or Open Source Matters.  The Joomla! logo is used under a limited license granted by Open Source Matters the  trademark holder in the United States and other countries.

<script type="text/javascript">
(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';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
})();
</script></body> 
 
Is Easy-Email for you?
Watch the demo video:
Easy-Email_Advanced_Demo_Small
Testimonial
Synchronize Outlook

Christina: "Now I do not understand how I could have lived without Easy-Email.

Easy-Email filled a need characterized by daily nuisances – a need that I knew I had but did not know how to fill."

Read more...
Free Videos

Sign up to get your free videos:

"5 steps to perfectly synchronized email"

E-mail Address:

30_day_money_back_guarantee_small
 No PayPal account required