php - Using GAPI to return list of pages with percentage of views -


Anyone know how can I return the following information from my Google Analytics account?

GA account

You need to use the PagePath dimension and pageviews metric to try something like the following:

  & lt ;? Php Requirement 'gapi.class.php'; $ GaEmail = 'youremail@email.com'; $ GaPassword = 'your password'; $ ProfileId = 'Your Profile ID'; $ Dimension = array ('pathway'); $ Metrics = array ('pageview'); $ SortMetric = Null; $ Filter = null; $ STARTDATE = '2011-02-01'; $ ENDDATE = '2011-02-28'; $ STARTINDEX = 1; $ MaxResults = 10000; $ Ga = new difference ($ geemail, $ gaPassword); $ Ga- & gt; RequestReportData ($ profileind, $ dimension, $ metrics, $ sortmet, $ filter, $ startdate, $ ended, $ startindex, maximum max); $ TotalPageviews = $ ga- & gt; GetPageviews (); Forex Currency ($ ga- & gt; getResults () as a result) {$ pageview = $ result-> Get Page View (); $ Percent pageview = round ((get $ result- & gt; page view / $ total page-view) * 100,2); Print "$ Result: $ Pageview: $ Percent Pageviews \ n"; }? & Gt;    

Comments