本文整理汇总了PHP中gapi::getPercentNewVisits方法的典型用法代码示例。如果您正苦于以下问题:PHP gapi::getPercentNewVisits方法的具体用法?PHP gapi::getPercentNewVisits怎么用?PHP gapi::getPercentNewVisits使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gapi
的用法示例。
在下文中一共展示了gapi::getPercentNewVisits方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
}
示例2: round
?>
</strong></td></tr>
<tr><td>Pages/Visit</td><td> <strong><?php
echo round($ga->getPageViewsPerVisit(), 2);
?>
</strong></td></tr>
<tr><td>Avg. Visit Duration</td><td> <strong><?php
echo convertSecsToTime(round($ga->getAvgTimeOnSite()));
?>
</strong></td></tr>
<tr><td>Bounce Rate</td><td> <strong><?php
echo round($ga->getVisitBounceRate(), 2);
?>
%</strong></td></tr>
<tr><td>% New Visits</td><td> <strong><?php
echo round($ga->getPercentNewVisits(), 2);
?>
%</strong></td></tr>
</table>
</div>
</div>
<div class="span6">
<div id="divPieChart"></div>
</div>
</div>
</div>
</div>
</div>
<?php
include 'footer.php';