【发布时间】:2015-12-01 00:40:12
【问题描述】:
我设置了一个 MC Funnels 示例,一切正常!!:
- 从 git 下载 Master。
- 输入一个帐户即可使用!
- 没关系!向我返回一些书籍样本的结果...
所以,我输入新代码来获取“mcf:”但收到“401 Unauthorized”
问题:如何/在何处授权对“mcf:xxxxxxx”指标和维度的查询?
我使用的代码:
include_once __DIR__ . '/../vendor/autoload.php';
include_once "templates/base.php";
// $client->setApplicationName("Client_Library_Examples");
// $client->setScopes(['https://www.googleapis.com/auth/books']); //not sure here..
// $service = new Google_Service_Books($client);
$service = new Google_Service_Analytics($client); //not sure here..
$mcf = $service->data_mcf(
'ga:80456636',
'2015-02-22',
'2015-02-23',
'mcf:totalConversionValue',
array(
'dimensions' => 'mcf:source,mcf:medium'
)
);
echo"<pre>";
var_dump($mcf);
echo"</pre>";
【问题讨论】:
标签: php google-api google-analytics-api google-api-php-client