使用 PHP 从 google 分析导入反向链接

Import backlinks from google analytics with PHP

我正在尝试使用 PHP 从 Google Analytics API 导入我的反向链接。我已尝试使用 Analytics API,但找不到正确的数据。 在搜索控制台中,我可以找到所有指向我页面的链接,但是从 Analytics ga:FullReferrer,我只能得到其他人点击进入我页面的链接。这根本不是同一个列表。

我试过https://ga-dev-tools.appspot.com/query-explorer/但找不到正确的列表。我看错地方了吗? Google Search Console 是否还有另一个 API?

function getResults($analytics, $profileId) {
  $optParams = array(
    'dimensions' => 'ga:fullReferrer, ga:source',
    'max-results' => '50000');

  return $analytics->data_ga->get(
      'ga:' . $profileId,
      '2005-01-01',
      'today',
      'ga:sessions', $optParams);
}

此 returns 个链接已被点击。但我想要 Google Search Console "Links to your page".

中的列表

非常感谢任何帮助 - 谢谢。

from Analytics ga:FullReferrer, I only get links that others have clicked to come to my page

Google Analytics 仅记录与您页面的交互,因此这是设计使然。 Search Console 也有一个 API,但是 judging from the documentation 这不会为您提供引荐来源信息。