无法检索 pagePathLevel1 维度
Can not retrieve pagePathLevel1 dimension
我正在尝试在此处检索 ga:pagePathLevel1
但出现错误
Warning: array_merge(): Argument #2 is not an array in
...\google-api-php-client\src\Google\Service\Analytics.php on line
1925
function getResults(&$analytics, $profileId) {
// Calls the Core Reporting API and queries for the number of sessions
// for the last seven days.
$analytica_report['data_ga_get'] = $analytics->data_ga->get(
'ga:' . $profileId,
'7daysAgo',
'today',
'ga:sessions,ga:pageviews,ga:uniquePageviews,ga:bounces,ga:timeOnPage,ga:sessionDuration,ga:entrances,ga:exits,ga:searchUniques,ga:transactions',
'ga:pagePathLevel1,ga:pagePathLevel2'
);
任何人都可以建议我如何使其正确吗?
方法中的最后一个参数是可选参数。尝试这样的事情
$optParams = array(
'dimensions' => 'ga:pagePathLevel1,ga:pagePathLevel2');
return $service->data_ga->get(
'ga:' . $profileId,
'7daysAgo',
'today',
'ga:sessions,ga:pageviews,ga:uniquePageviews,ga:bounces,ga:timeOnPage,ga:sessionDuration,ga:entrances,ga:exits,ga:searchUniques,ga:transactions',
$optParams);
}
您可能还会发现 documentation 有用。
我正在尝试在此处检索 ga:pagePathLevel1
但出现错误
Warning: array_merge(): Argument #2 is not an array in ...\google-api-php-client\src\Google\Service\Analytics.php on line 1925
function getResults(&$analytics, $profileId) {
// Calls the Core Reporting API and queries for the number of sessions
// for the last seven days.
$analytica_report['data_ga_get'] = $analytics->data_ga->get(
'ga:' . $profileId,
'7daysAgo',
'today',
'ga:sessions,ga:pageviews,ga:uniquePageviews,ga:bounces,ga:timeOnPage,ga:sessionDuration,ga:entrances,ga:exits,ga:searchUniques,ga:transactions',
'ga:pagePathLevel1,ga:pagePathLevel2'
);
任何人都可以建议我如何使其正确吗?
方法中的最后一个参数是可选参数。尝试这样的事情
$optParams = array(
'dimensions' => 'ga:pagePathLevel1,ga:pagePathLevel2');
return $service->data_ga->get(
'ga:' . $profileId,
'7daysAgo',
'today',
'ga:sessions,ga:pageviews,ga:uniquePageviews,ga:bounces,ga:timeOnPage,ga:sessionDuration,ga:entrances,ga:exits,ga:searchUniques,ga:transactions',
$optParams);
}
您可能还会发现 documentation 有用。