在您的查询中,您需要提供采样级别
samplingLevel=DEFAULT Optional.
Use this parameter to set the sampling level (i.e. the number of visits used to
calculate the result) for a reporting query. The allowed values are consistent with
the web interface and include:
•DEFAULT — Returns response with a sample size that balances speed and accuracy.
•FASTER — Returns a fast response with a smaller sample size.
•HIGHER_PRECISION — Returns a more accurate response using a large sample size,
but this may result in the response being slower.
If not supplied, the DEFAULT sampling level will be used.
您还没有说明您使用的是哪种语言,因此您必须检查库中的该语言并弄清楚如何发送它。
更新:尝试帮助编写代码。我没有对此进行测试,但我猜你会将它添加为可选参数。让我知道它是否不起作用,我会看看我是否可以让它工作。
$optParams = array(
'dimensions' => 'ga:dateHour,ga:hour',
'filters' => 'ga:pagePath=~'.$pagelink.'*',
'max-results' => 1,
'sort' => 'ga:dateHour',
'samplingLevel' => 'HIGHER_PRECISION' );
$results_starttime = $connect->data_ga->get( 'ga:' . $signedupuser["google id"],
$startdate_analysed,
$enddate_analysed,
'ga:uniquePageviews', $optParams );
更新 2:确保您从我检查过的 GitHub google/google-api-php-client下载了 lib,并且那里的 Analytics.php 确实有支持采样级别的代码。
更新 3 您从上面的 GitHub 检查链接获取旧版本的 lib。
google-api-php 客户端
地位:
库的下一个主要版本(1.0.1-beta)的 beta 版本可用,请尽可能迁移。较新的版本发布在 GitHub 上。所有新的开发和问题跟踪都将在 Github 上进行。