?
Path : /home/admin/public_html/old/board/modules/mod_gacounter/ |
Current File : /home/admin/public_html/old/board/modules/mod_gacounter/helper.php |
<?php /** * @package Google Analytics Counter Joomla 1.5 module * @version 1.0 * @author Erwin Schro (http://www.joomla-labs.com) * @author Convert to Joomla from WebResourcesDepot's tutorial on Google Analytic Counter Badge * @copyright Copyleft (C) 2010 J!Labs. All rights reserved. * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html * * Google Analytics Counter has been developed and distributed under the terms of the GPL * @copyright Joomla is Copyright (C) 2005 Open Source Matters. All rights reserved. * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only */ defined( '_JEXEC' ) or die( 'Restricted access' ); require_once('elements/gapi.class.php'); class modGACounterHelper { var $count; function modGACounterHelper($params, $module) { $email = $params->get('email'); // your Google email account i.e erwinxxx@gmail.com $passwd = $params->get('password'); $profileID = $params->get('profileID'); $displayType = $params->get('displayType'); if ($displayType=='visits') { $this->count = $this->getVisitsCount($email, $passwd, $profileID); } else if ($displayType=='pageviews') { $this->count = $this->getPageviewsCount($email, $passwd, $profileID); } return $this; } function getVisitsCount($email, $passwd, $profileID) { $ga = new gapi($email,$passwd); $ga->requestReportData($profileID,array('browser','browserVersion'),array('visits')); return $ga->getVisits(); } function getPageviewsCount($email, $passwd, $profileID) { $ga = new gapi($email,$passwd); $ga->requestReportData($profileID,array('browser','browserVersion'),array('pageviews')); return $ga->getPageviews(); } }