Php – Using Google Analytics API with PHP

google analyticsPHPterminology

I am using the Google Analytics PHP class to get data from Google Analytics.
http://code.google.com/p/gapi-google-analytics-php-interface/wiki/GAPIDocumentation

I would like to get a report of "Bounce Rate" For "Top Contnet".

The thing is I am not familiar with the terminology.

When I am trying to get a "content" report or "topcontent" or "top_content" it says that there in no such metric. I simply don't know the right expressions.

Does anyone know where can I find a list of all expressions? metrics & dimensions?

Thanks.

Best Answer

Top content isn't a metric, it's just a list of the pages on your site with the highest number of page views.

The metric you're looking for is 'entranceBounceRate' and the dimension is 'pagePath'. You want to get the bounce rate for the top X most visited pages on your site, so you'll want to limit your results and sort the results by '-pageviews' (pageviews descending).

If you want to get the bounce rate for the top 10 most viewed pages on your site, your query should look like this:

$ga = new gapi('email@yourdomain.com','password');
$ga->requestReportData(145141242,array('pagePath'),array('entranceBounceRate','pageviews'),array('-visits'),null,null,null,10);

The Google Analytics Export API has a data feed query explorer that should help you out considerably when using GAPI: http://code.google.com/apis/analytics/docs/gdata/gdataExplorer.html

Also, here's a list of all available dimensions and metrics you can pull from the API: http://code.google.com/apis/analytics/docs/gdata/gdataReferenceDimensionsMetrics.html

Definitely read over the GAPI documentation: http://code.google.com/p/gapi-google-analytics-php-interface/wiki/GAPIDocumentation