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


PHP gapi::getUpdated方法代码示例

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


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

示例1: _monthPageViewsVisits

 /**
  * A temporary function to hold the first example of a chart data return.
  * We can make this more robust and to handle more uses cases.
  * @todo  	Make an entire analytics plugin to be part of the reports plugin.
  */
 public function _monthPageViewsVisits()
 {
     if (!empty($instance) && defined('__REPORTS_ANALYTICS_' . $instance)) {
         extract(unserialize(constant('__REPORTS_ANALYTICS_' . $instance)));
     } else {
         if (defined('__REPORTS_ANALYTICS')) {
             extract(unserialize(__REPORTS_ANALYTICS));
         }
     }
     if (!empty($userName) && !empty($password) && !empty($setAccount)) {
         App::import('Vendor', 'Reports.gapi');
         $ga = new gapi($userName, $password, isset($_SESSION['ga_auth_token']) ? $_SESSION['ga_auth_token'] : null);
         $_SESSION['ga_auth_token'] = $ga->getAuthToken();
         // $filter = 'country == United States && browser == Firefox || browser == Chrome';
         // $report_id, $dimensions, $metrics, $sort_metric=null, $filter=null, $start_date=null, $end_date=null, $start_index=1, $max_results=30
         // http://code.google.com/apis/analytics/docs/gdata/gdataReferenceDimensionsMetrics.html#ga:visitors
         foreach ($ga->requestAccountData() as $account) {
             if (is_object($account)) {
                 if ($account->properties['webPropertyId'] == $setAccount) {
                     $reportId = $account->properties['profileId'];
                 }
             }
         }
         $backMonth = date('Y-m-d', mktime(0, 0, 0, date("m") - 1, date("d"), date("Y")));
         $ga->requestReportData(53475, array('date'), array('pageviews', 'visits'), 'date', null, $backMonth, date('Y-m-d'));
         $i = 0;
         foreach ($ga->getResults() as $result) {
             #debug($result);
             $chartData[$i]['pageviews'] = $result->getPageviews();
             $chartData[$i]['visits'] = $result->getVisits();
             $chartData[$i]['date'] = $result->getDate();
             $i++;
         }
         $chartData['totalResults'] = $ga->getTotalResults();
         $chartData['totalPageViews'] = $ga->getPageviews();
         $chartData['totalVisits'] = $ga->getVisits();
         $chartData['updated'] = $ga->getUpdated();
         return $chartData;
     } else {
         // google analytics username and password must be set in settings (__REPORTS_ANALYTICS)
         return;
     }
 }
开发者ID:ayaou,项目名称:Zuha,代码行数:48,代码来源:WebpageReportsController.php

示例2:

</table>

<table>
<tr>
  <th>Total Results</th>
  <td><?php 
echo $ga->getTotalResults();
?>
</td>
</tr>
<tr>
  <th>Total Pageviews</th>
  <td><?php 
echo $ga->getPageviews();
?>
</tr>
<tr>
  <th>Total Visits</th>
  <td><?php 
echo $ga->getVisits();
?>
</td>
</tr>
<tr>
  <th>Results Updated</th>
  <td><?php 
echo $ga->getUpdated();
?>
</td>
</tr>
</table>
开发者ID:Hoplite-Software,项目名称:observatory,代码行数:31,代码来源:example.report.php


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