Posted By


yanek1988 on 03/03/11

Tagged


Statistics


Viewed 167 times
Favorited by 0 user(s)

Zend_Gdata_Analytics


/ Published in: PHP
Save to your folder(s)



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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.