Google Analytics Tracking Module For Joomla 2.5


Google Analytics Tracking Module is a simple module for Joomla 1.0.x., Joomla 1.5 and also working on Joomla 2.5 (with a Paki trick :p)   tested by me on my new project.  It is used for inserting Google Analytics tracking code to the Joomla sites as a module. This module makes it possible to add the tracking code before the closing body tag in template, which is recommended by Google. Module tracks all pages of Joomla cms including 3rd party components. It is really great way to insert Google  Analytics Tracking Code instead of that you manually edit the every page of your template which you want to track.   You can see User Remarks/Rating Here. You can Download it from it Here.

Although, I am new to Joomla but how I installed it to my site here we go:

Installation Instruction (Joomla 2.5)

1. Download it from the link given above.

2. Unzip the folder.

3. You will see the helper.php file in it.  Open it in any Text Editior (Notepad++ is recommended).  It would look like:

<?php
class modGAEstime
{
/**
* Retrieves the hello message
*
* @param array $params An object containing the module parameters
* @access public
*/
function getHello( $params )
{

$ua = $params->get( ‘Enter your Google Tracking Code Here‘ );
$subdomain = $params->get( ‘Your Subdomain 1 if you have‘, 0 );
$subdomain2 = $params->get( ‘Your Subdomain 2 if you have‘, ‘Your domain.com here‘ );
$hash = $params->get( ‘hash’, 0 );

$koodi = “”;

$koodi .= “<script type=\”text/javascript\”>\n”;
$koodi .= “var _gaq = _gaq || [];\n”;
$koodi .= “_gaq.push([‘_setAccount’, ‘” . $ua . “‘]);\n”;
if($subdomain == 1){
$koodi .= “_gaq.push([‘_setDomainName’, ‘” . $subdomain2 . “‘]);\n”;
}
if($hash == 1){
$koodi .= “_gaq.push([‘_setAllowLinker’, true]);\n”;
}
$koodi .= “_gaq.push([‘_trackPageview’]);\n”;

$koodi .= ” (function() {
var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl&#8217; : ‘http://www&#8217;) + ‘.google-analytics.com/ga.js’;
var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);
})();”;
$koodi .= “\n</script>\n”;

return $koodi;

}
}
?>

6. Put your data as showing above.

7. Compress it again into Zip.

8. Finally, Install it through Extension Manager from your Joomla Administration Panel.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s