dsuikgi9199
2017-04-06 10:15
浏览 66
已采纳

如何向Google Analytics api请求添加维度

The examples given by Google are a very simple query request. however, when I try to add more parameters, it will throw errors and I don't exactly know how to structure the syntax.

This simple query request works:

 return $analytics->data_ga->get(
  'ga:' . $viewID,
  $startDate,
  $endDate,
  'ga:sessions'
);

I need more information and I've already used Google's Query Explorer to get the Information but I just don't know how to structure my PHP query. The Information I want to request is also ga:pageviews as another metric, ga:pagePath and ga:pageTitle as dimensions and also a filter. I already fail at adding a second metric.

I have tried this:

return $analytics->data_ga->get(
  'ga:' . $viewID,
  $startDate,
  $endDate,
  'ga:sessions',
  'ga:pageviews'
);

simply adding it doesn't work. Can anyone point me in the correct direction?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题