Wednesday, May 20, 2009

How to add SiteCatalyst Code in Joomla

There are more and more companies move their platforms to the open source CMS Joomla. At the same time they need to migrate their Omniture SiteCatalyst tracking code to Joomla platform as well. Joomla is good, however as most of the open source system, the development documentation for Joomla is limited. Here I share some PHP code and SiteCatalyst tracking code to show how can you add the tracking code into the Joomla Template and generate the PageName dynamically.

You just need the add the follow code into the Template index.php file.

global $mainframe;

// Get the PathWay object from the application
$pathway =& $mainframe->getPathway();
$items = $pathway->getPathWay();


$PagePath="MainPage";
$count = count($items);
for ($i = 0; $i < $count; $i ++)
{
$items[$i]->name = stripslashes(htmlspecialchars($items[$i]->name));
//echo $items[$i]->name;
$PagePath=$PagePath.":".$items[$i]->name;


}
echo $PagePath;

?>




No comments: