Can I request multiple Metrics using the Data API PHP client library?
ex) date for dimension, sessions and totalUsers for metric for Data API request
Sure why not? Metrics is just an array same as dimensions.
$response = $client->runReport([
'property' => 'properties/' . $property_id,
'dateRanges' => [
new DateRange([
'start_date' => '2020-03-31',
'end_date' => 'today',
]),
],
'dimensions' => [new Dimension(
[
'name' => 'date',
]
),
],
'metrics' => [new Metric(
[
'name' => 'sessions',
]
),new Metric(
[
'name' => 'totalUsers',
]
)
]
]);