Posted By

yanek1988 on 03/03/11


Tagged

Analytics zend


Versions (?)

Zend_Gdata_Analytics


 / Published in: PHP
 

  1. $client = Zend_Gdata_ClientLogin::getHttpClient(
  2. '[email protected]',
  3. 'password',
  4. Zend_Gdata_Analytics::AUTH_SERVICE_NAME
  5. );
  6.  
  7. $service = new Zend_Gdata_Analytics($client);
  8.  
  9. $query = $service->newDataQuery()
  10. ->setProfileId('id_strony_z_analytics')
  11. ->addDimension(Zend_Gdata_Analytics_DataQuery::DIMENSION_PAGE_PATH)
  12. ->addMetric(Zend_Gdata_Analytics_DataQuery::METRIC_VISITS)
  13. ->addMetric(Zend_Gdata_Analytics_DataQuery::METRIC_PAGEVIEWS)
  14. ->setStartDate(date('Y-m-d', strtotime('2011-02-01')))
  15. ->setEndDate(date('Y-m-d', strtotime('2011-03-01')))
  16. ->setSort(Zend_Gdata_Analytics_DataQuery::METRIC_VISITS, true)
  17. ->setMaxResults(20);
  18.  
  19. $result = $service->getDataFeed($query);
  20.  
  21. foreach($result as $row){
  22. $pre = Zend_Gdata_Analytics_DataQuery::DIMENSION_PAGE_PATH.'=/page/';
  23. echo $row->title . ' - ' . $row->getMetric(Zend_Gdata_Analytics_DataQuery::METRIC_PAGEVIEWS);
  24. echo '<br/>';
  25. }

Report this snippet  

You need to login to post a comment.