title: Google Analytics API PHP -Get Top 5 Pages
body: <p>I'm trying to work out how to get the top 5 pages from my Google Analytics Project API in PHP. So far I've made the following code, but it doesn't appear to work - any ideas?</p>
  
  <pre><code> private function getTopPages($profileId) {
  
     $optParams = array(
        'sort' =&gt; 'ga:pageviews',
        'max-results' =&gt; '5');
  
     return $this-&gt;analytics-&gt;data_ga-&gt;get(
         'ga:' . $profileId,
         '2012-09-01',
         '2012-09-30',
         'ga:pagePath',
         $optParams);
  
  }
  </code></pre>