: Google Analytics in Joomla I was asked by a client to insert the Google Analytics code in his joomla page. No problem, I said, peace of cake. Little did I know that it is going to be such
I was asked by a client to insert the Google Analytics code in his joomla page. No problem, I said, peace of cake.
Little did I know that it is going to be such a struggle.
First of all, I downloaded the active template and searched through code and couldn't find any HTML except about 20 index.html pages with only:
<html><body bgcolor="#FFFFFF"></body></html>.
Now I tired editing through Joomla and when the index page opens and I click edit the HTML, it's all PHP.
defined( '_JEXEC' ) or die( 'Restricted access' );
require_once('layouts/GKTemplate.php');
$Template = new GKTemplate($this);
if($Template->settings["ie6info"] && $Template->IE6Detection())
{
$Template->loadSkeleton("ie6");
}
else
{
$Template->loadBlock("gk_wrapper");
}
I'm not too good with PHP, I'm more of a Asp.net kinda guy, so I don't understand this code, but where is the <head> tag in which I'm supposed to insert the Google Analytics code snippet?
More posts by @Jennifer507
4 Comments
Sorted by latest first Latest Oldest Best
You don't need to edit actual files at all. Go into your site's administrator interface, then go to Extensions-->Template Manager. Click on the template name, and then the Edit HTML button. It will open the site's main framework, which all other code opens in. Just add the analytics javascript at the very bottom, still inside the body tag.
This is very simple, you just need to know where to look.
In the template for the site there exists an index.php file. Put the Google Analytics's JavaScript in the head tag near the top.
In the included file layouts/GKTemplate.php there will be some functions loadSkeleton and loadBlock which may have the code you require. Though they could easily be calling other functions and so on.
If you have a way to search through multiple files (Notepad++ can do this) search for <head> to find where to put the code.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.