当前位置: 首页>>代码示例>>PHP>>正文


PHP gapi::getVisitors方法代码示例

本文整理汇总了PHP中gapi::getVisitors方法的典型用法代码示例。如果您正苦于以下问题:PHP gapi::getVisitors方法的具体用法?PHP gapi::getVisitors怎么用?PHP gapi::getVisitors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gapi的用法示例。


在下文中一共展示了gapi::getVisitors方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: date

$giorni_giorno = 1;
$data_ricerca_anno = date("Y-m-d", time() - 86400 * $giorni_anno);
$data_ricerca_mese = date("Y-m-d", time() - 86400 * $giorni_mese);
$data_ricerca_settimana = date("Y-m-d", time() - 86400 * $giorni_settimana);
$data_ricerca_giorno = date("Y-m-d", time() - 86400 * $giorni_giorno);
$oggi = date("Y-m-d");
$ga = new gapi(ga_email, ga_password);
//////////////
// GIORNO
//////////////
$ga->requestReportData(ga_profile_id, array('visitorType'), array('visitors', 'pageviews', 'visits', 'timeOnSite', 'avgtimeOnsite', 'percentNewVisits', 'newVisits', 'pageviewsPerVisit', 'uniquePageviews'), '', '', $data_ricerca_giorno, date("Y-m-d"), 1, 1000);
echo "<div class=\"gacounter\">";
echo "<h3>Periodo osservazione: ultimo giorno </h3>";
echo "<p> dal " . date("d-m-Y", time() - 86400 * $giorni_giorno) . " al " . date("d-m-Y") . "</p>";
echo "<ul><li>visite totali: " . $ga->getVisits() . "</li>";
echo "<li class=\"alternato\">visitatori totali: " . $ga->getVisitors() . "</li>";
echo "<li>nuovi visitatori: " . $ga->getnewVisits() . "</li>";
echo "<li class=\"alternato\">pagine viste: " . $ga->getPageviews() . "</li>";
echo "<li>pagine viste per visita: " . round($ga->getpageviewsPerVisit(), 2) . "</li>";
echo "<li class=\"alternato\">pagine uniche: " . $ga->getuniquePageviews() . "</li>";
$t_medio = tempo_medio($ga->getavgTimeOnSite());
echo "<li>tempo medio di permanenza sul sito: " . $t_medio . "</li></ul>";
echo "</div>";
//////////////
// SETTIMANA
//////////////
$ga->requestReportData(ga_profile_id, array('visitorType'), array('visitors', 'pageviews', 'visits', 'timeOnSite', 'avgtimeOnsite', 'percentNewVisits', 'newVisits', 'pageviewsPerVisit', 'uniquePageviews'), '', '', $data_ricerca_settimana, date("Y-m-d"), 1, 1000);
echo "<div class=\"gacounter\">";
echo "<h3>Periodo osservazione: ultimi 7 giorni</h3>";
echo "<p> dal " . date("d-m-Y", time() - 86400 * $giorni_settimana) . " al " . date("d-m-Y") . "</p>";
echo "<ul><li>visite totali: " . $ga->getVisits() . "</li>";
开发者ID:venerdi2,项目名称:pasw2015,代码行数:31,代码来源:gacounter.php

示例2: getGAgeneral

 function getGAgeneral()
 {
     $app =& JFactory::getApplication();
     $config = $app->getuserState('rsseoConfig');
     try {
         $ga = new gapi($config['analytics.username'], $config['analytics.password'], $config['ga.token']);
         $ga->requestReportData($config['ga.account'], '', array('visits', 'pageviews', 'pageviewsPerVisit', 'avgTimeOnSite', 'visitBounceRate', 'percentNewVisits', 'visitors'), null, null, $config['ga.start'], $config['ga.end']);
         $return = array();
         $totalvisits = $ga->getVisits();
         $totalvisits = $totalvisits === '' ? JText::_('RSSEO_NOT_AVAILABLE') : $totalvisits;
         $uniquevisits = $ga->getVisitors();
         $uniquevisits = $uniquevisits === '' ? JText::_('RSSEO_NOT_AVAILABLE') : $uniquevisits;
         $totalpageviews = $ga->getPageviews();
         $totalpageviews = $totalpageviews === '' ? JText::_('RSSEO_NOT_AVAILABLE') : $totalpageviews;
         $avgpageviews = $ga->getPageviewsPerVisit();
         $avgpageviews = $avgpageviews === '' ? JText::_('RSSEO_NOT_AVAILABLE') : number_format($avgpageviews, 2);
         $timeonsite = $ga->getAvgTimeOnSite();
         $timeonsite = $timeonsite === '' ? JText::_('RSSEO_NOT_AVAILABLE') : $this->convertseconds(number_format($timeonsite, 0));
         $bouncerate = $ga->getVisitBounceRate();
         $bouncerate = $bouncerate === '' ? JText::_('RSSEO_NOT_AVAILABLE') : number_format($bouncerate, 2) . ' %';
         $newvisits = $ga->getPercentNewVisits();
         $newvisits = $newvisits === '' ? JText::_('RSSEO_NOT_AVAILABLE') : number_format($newvisits, 2) . ' %';
         $obj1 = new stdClass();
         $obj2 = new stdClass();
         $obj3 = new stdClass();
         $obj4 = new stdClass();
         $obj5 = new stdClass();
         $obj6 = new stdClass();
         $obj7 = new stdClass();
         $obj1->title = JText::_('RSSEO_GA_GENERAL_TOTALVISIORS');
         $obj4->title = JText::_('RSSEO_GA_GENERAL_AVGPAGEVIEWS');
         $obj1->value = $totalvisits;
         $obj4->value = $avgpageviews;
         $obj1->descr = JText::_('RSSEO_GA_GENERAL_TOTALVISIORS_DESC');
         $obj4->descr = JText::_('RSSEO_GA_GENERAL_AVGPAGEVIEWS_DESC');
         $obj2->title = JText::_('RSSEO_GA_GENERAL_UNIQUEVISITS');
         $obj5->title = JText::_('RSSEO_GA_GENERAL_TIMEONSITE');
         $obj2->value = $uniquevisits;
         $obj5->value = $timeonsite;
         $obj2->descr = JText::_('RSSEO_GA_GENERAL_UNIQUEVISITS_DESC');
         $obj5->descr = JText::_('RSSEO_GA_GENERAL_TIMEONSITE_DESC');
         $obj3->title = JText::_('RSSEO_GA_GENERAL_TOTALPAGEVIEWS');
         $obj6->title = JText::_('RSSEO_GA_GENERAL_BOUNCERATE');
         $obj3->value = $totalpageviews;
         $obj6->value = $bouncerate;
         $obj3->descr = JText::_('RSSEO_GA_GENERAL_TOTALPAGEVIEWS_DESC');
         $obj6->descr = JText::_('RSSEO_GA_GENERAL_BOUNCERATE_DESC');
         $obj7->title = JText::_('RSSEO_GA_GENERAL_NEWVISITS');
         $obj7->value = $newvisits;
         $obj7->descr = JText::_('RSSEO_GA_GENERAL_NEWVISITS_DESC');
         $return[] = $obj1;
         $return[] = $obj2;
         $return[] = $obj3;
         $return[] = $obj4;
         $return[] = $obj5;
         $return[] = $obj6;
         $return[] = $obj7;
         return $return;
     } catch (Exception $e) {
         return $e->getMessage();
     }
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:62,代码来源:analytics.php

示例3:

		</table>
		
		<table>
		<tr>
		  <th>Rows Returned</th>
		  <td><?php 
echo $ga->getTotalResults();
?>
</td>
		</tr>
		<tr>
		</tr>
		<tr>
		  <th>Total Visits</th>
		  <td><?php 
echo $ga->getVisitors();
?>
</td>
		</tr>
		<tr>
		</tr>
		<tr>
		  <th>Results Updated</th>
		  <td><?php 
echo $ga->getUpdated();
?>
</td>
		</tr>
		<tr>
			<th>Data Range: </th><td><?php 
echo $ga->getstartDate();
开发者ID:RCDawson,项目名称:patrick,代码行数:31,代码来源:index.php


注:本文中的gapi::getVisitors方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。