如何在php中的谷歌分析中显示搜索概述

发布时间:2022-04-30 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了如何在php中的谷歌分析中显示搜索概述脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
何在 PHP中的谷歌分析中显示搜索概述?

显示GOOGLE分析页面

访问
76

我正在使用此功能ga:organicSeArches链接在这里developers.google.com/analytics/devguides/reporting/core

我想在我的新分析网站中显示这些数据,但此功能显示我74次访问

我可以知道我错在哪里.

这是我的代码到目前为止: –

$ga1 = new gapi($ga_email,$ga_password);

/* We are using the 'source' dimension and the 'visITs' metrics */
$dimensions = array('source');
$metrics    = array('visits','organicSearches');

/* We will sort the result be desending order of visits,and hence the '-' sign before the 'visits' string */


$ga1->requestReportData($ga_PRofile_id,$dimensions,$metrics,'-visits',// Sort by 'visits' in descending order
                       $filter,// Filter the data
                       '2012-10-05',// Start Date
                       '2012-11-04',// End Date
                       1,// Start Index
                       500 // Max results
                       );

$gaResults = $ga1->getResults();

$i=1;

foreach($gaResults as $result)
{
    printf("%-4d %-40s %5d\n",$i++,$result->getSource(),$result->getVisits());
}

echo "\n-----------------------------------------\n";
echo "total Results : {$ga1->getTotalResults()}";    

echo "getOrganicSearches:".$ga1->getOrganicSearches().'<br />';

有没有其他功能显示这些数据???

谢谢

解决方法

这是我用来获取自然搜索结果的参数(来自搜索引擎的非付费访问)

$params = array(
        'dimensions' => 'ga:source,ga:keyword','sort' => '-ga:visits,ga:source','filters' = 'ga:medium==organic'
    );

请注意’过滤器’行.它的值设置为’ga:medium == organic’.

这将返回有机流量的访问次数,您可以再次拨打付费话以复制Google Analytics网络应用中的“搜索概述”页面.

@H_406_43@

脚本宝典总结

以上是脚本宝典为你收集整理的如何在php中的谷歌分析中显示搜索概述全部内容,希望文章能够帮你解决如何在php中的谷歌分析中显示搜索概述所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。