I have successfully implemented Google Analytics API in my Laravel app following the (rather complex) documentation. When creating this metrics object, I get the response from server, no problem there:
$sessions = new Google_Service_AnalyticsReporting_Metric();
$sessions->setExpression("ga:sessions");
However, this is the data I need:
So then I figured I need some other metrics inside to get the data I need and I searched on the official link for anything related to source
, but which ever I used from the list I would get the following response:
"""
{
"error": {
"code": 400,
"message": "Unknown metric(s): ga:source
For details see https://developers.google.com/analytics/devguides/reporting/core/dimsmets.",
"errors": [
{
"message": "Unknown metric(s): ga:source
For details see https://developers.google.com/analytics/devguides/reporting/core/dimsmets.",
"domain": "global",
"reason": "badRequest"
}
],
"status": "INVALID_ARGUMENT"
}
}
"""
Is there a way for me to fetch the data I need?