I've finally figured out how i connected to the Google Analytics, correct - and I'm now able to access data to some point. I'm using the google-api-php-client.
I can work with metrics just fine fx, by doing
return $analytics->data_ga->get(
'ga:' . $profileId,
'7daysAgo',
'today',
'ga:sessions,ga:pageviews,ga:sessionDuration');
which will return me number of sessions, pageviews, and session duration. But now lets say I am interested in using some of the dimensions as well - Maybe i want the query return site usage data for all traffic by search engine, sorted by pageviews in descending order.
dimensions=ga:source
metrics=ga:pageviews,ga:sessionDuration,ga:exits
filters=ga:medium==cpa,ga:medium==cpc,ga:medium==cpm,ga:medium==cpp,ga:medium==cpv,ga:medium==organic,ga:medium==ppc
sort=-ga:pageviews
the data_ga->get function calls for the following parameters: $ids, $startDate, $endDate, $metrics, $optParams = array()
I tried supplying the dimensions and filters in a array, but it returns me the following errors
Warning: Illegal string offset 'type' in xxxxxxxxx/src/Google/Service/Resource.php on line 269
Warning: Illegal string offset 'location' in xxxxxxxxx/src/Google/Service/Resource.php on line 272
Warning: Illegal string offset 'location' in xxxxxxxxx/src/Google/Service/Resource.php on line 274