使用している言語について言及していないため、どのような種類の日付を扱うインターフェイスを使用できるかはわかりませんが、ga:week,ga:year
プラグインして使用できる年の週を提供する必要があります適切に日付を作成します。PHP では、次のようになります。
<?php
// assuming use of the official PHP API for Google services, and
// that you've appropriately initialized the connection, and that
// you've chosen to "$client->setUserObjects(true)", and that you've
// initialized the necessary variables...
$results = $service->data_ga->get($analytics_id, $start_date, $end_date, 'ga:visitors',
array('dimensions' => 'ga:week,ga:nthWeek,ga:year'));
$columns = array();
foreach ($results->columnHeaders as $headidx => $col) {
$columns[$col->name] = $headidx;
}
$traffic = array();
foreach ($results->rows as $idx => $week) {
$date = new DateTime;
$date->setISODate($week[$columns['ga:year']], $week[$columns['ga:week']]);
$traffic[$week[$columns['ga:nthWeek']]] = array('date' => $date, 'visitors' => $week[$columns['ga:visitors']], 'visits' => $week[$columns['ga:visits']], 'pageviews' => $week[$columns['ga:pageviews']]);
}
ksort($traffic);
// $traffic now holds a sorted array of your week by week traffic, with the full
// date in the DateTime object that you can access and format however you please
?>