Joomla Pro Tutorial

Get Joomla Tutorials from Pro Freelancer

How to add Google Analytics to your Joomla site or template

How to add Google Analytics to your Joomla site or template
Since we first stumbled upon Google Analytics to track website visitor statistics, we make it a point to install it on each and every site. Analytics is a great visitors statistics tool for everyone, from newbies to the more advanced designers wishing to fully optimize the content of their websites so adding to Joomla Google Analytics codes should (and usually is) one of the very first steps you do when launching a new website.

Using Google Analytics with Joomla is something which can be achieved very simply.
Joomla Google Analytics Plugin

Of course, for those who don't like messing around with code, there is the option of using a Joomla Google Analytics plugin which automatically inserts the code in each page. 

As with most Joomla plugins, you just need to install it, set the Google Analytics code which you fetch from Google Analytics, enable it and you're good to go!

 
Joomla Google Analytics - The manual method

To make sure that the analytics code is available in all pages, you'll need to add the script code to the index.php file of the default template you are using. To do this, simply go to the /templates/<yourtemplate>/index.php and paste the code you get from Google Analytics just before the closing </body> tag:

<script src="https://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "xxxxxxxxxx";
urchinTracker();
</script>


</body>

This will generate the tracking code on each Joomla page, and thus Analytics will be logging each hit on each page, which is exactly the result you want to achieve ;)
© 2024, Joomla King

Contact Info

Search