Google Analytics(分析)SEO-PHP API - php

我有一个PHP文件,可为我提供Google Analytics(分析)数据,例如综合浏览量,首页或有机数据等简单数据。

现在,我不太希望从SEO部分获得东西。

例如:TOP 50个搜索关键字(带有印象数和点击数)

我在API中找不到任何有关如何获取这些值的帮助。

这是我的api调用的示例:

$params = array(
    'dimensions' => array('date', 'pagePath', 'pageTitle'),
    'metrics' => array('sessions', 'pageviews'),
    'sort' => '-ga:sessions',
    'filters' => null,
    'startdate' => $startdate,
    'enddate' => $enddate,
    'startindex' => null,
    'limit' => 25,
    'mapping' => array('pagepath' => 'pagepath', 'pagetitle' => 'pagetitle', 'sessions' => 'visits', 'pageviews' => 'pageviews'),
);

$results = $this->service->data_ga->get($this->profile, $params['startdate'], $params['enddate'], $metrics, $optParams);

参考方案

Google Analytics(分析)中显示的搜索引擎优化数据实际上来自Google Search Console(网站站长工具),可通过Google Search Console API获得。
https://developers.google.com/webmaster-tools/?hl=en

Google Analytics(分析)首页显示 - php

我已经环顾了一段时间,但尚未找到答案。是否有人对我检查数字时为什么“主页”显示为以下内容有任何见解: “ /index.php,index/,index,index-,/index.php”在GA中的一行上?我在其他几页上也看到了相同的内容: /customer_account-exec/index.php,index/,index,index-,/inde…

Google Analytics API - php

我正在实施Google Analytics(分析)Api。授权完成没有问题。成功授权后,我得到403 return code并得到消息:User does not have sufficient permissions for this profile。我的帐户具有Google Analytics(分析)数据,可以跟踪多个网站,并且我可以从网络浏览器访问它而…

Analytics API:自动身份验证 - php

我正在尝试使用Google Analytics(分析)Reporting API构建仪表板,以便为我公司的客户创建报告。问题是我需要使用cronjob创建报告,但这需要身份验证。我尝试了以下方法:1.使用API for web applications:我设法完成了这项工作,但是OAuth2流程通过将我重定向到Google登录页面,迫使我向Google进行身…

Google Analytics(分析)报告中的分页 - php

在这里,我正在获取下一个和上一个URL,但是当尝试使用该URL访问下一页时,由于网址= https://www.googleapis.com/analytics/v3/data/ga?ids=ga:85914642&dimensions=ga:pagePath,ga:date&metrics=ga:pageviews,ga:uniquePag…

Analytics(分析)API oauth2callback在codeigniter中重定向 - php

我在尝试尝试以下示例的codeigniter中遇到问题:Hello Analytics API: PHP quickstart for web applications始终重定向到身份验证页面https://accounts.google.com/o/oauth2/auth?response_type=code 我认为问题是我无法获取代码:$_GET[�…