I am using the Google Analytics API and want to know the average session duration of a spezific content site.
To get the metrics I am using this PHP Code:
$result = $analytics->data_ga->get(
'ga:XXXXXXX',
'2012-01-01',
date("Y-m-d"),
'ga:visits',
array(
'filters' => 'ga:pagePath==MY_URL',
'dimensions' => 'ga:pagePath',
'metrics' => 'ga:pageviews,ga:sessions,ga:uniquePageviews,ga:avgSessionDuration,ga:bounces',
'sort' => '-ga:uniquePageviews',
'max-results' => '25'
)
);
I get the following result:
[0] => Array
(
[0] => MY_URL
[1] => 8966
[2] => 7434
[3] => 7434
[4] => 17.15496368038741
[5] => 6245
)
Numbers 0-3 and 5 are exactly the same like Google Analytics Dashboard numbers (when I am logged in with my browser in google analytics)
But average duration time on site doesn't fit. API shows me 17.15 seconds and Google Analytics dashboard shows me 1 minute and 23 seconds.
Are these the same metrics? I want to have the "average duration time on site" (like standard Analytics Dashboard shows me).
Thanks!