How to show Search Overview in google analytics in php ??

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

Google analytics page shown

显示了Google分析页面

Visits 76

I am using this function ga:organicSearches link is here developers.google.com/analytics/devguides/reporting/core

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

I want to show this data inside my new analytics website but this function shows me 74 Visits

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

May I know where I am wrong.

我可以知道我哪里错了。

Here is my Code so far :-

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

$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 />';

Is there any other function to show this data ???

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

Thanks

1 个解决方案

#1


1

Here's the parameters I use to get organic search results (non paid visits from search engines)

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

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

Notice that 'filters' line. It's value is set to 'ga:medium==organic'.

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

This will return you the visits for organic traffic, you can do another call for paid to replicate the Search Overview page in Google Analytics web app.

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

更多相关文章

  1. 阅读使用JavaScript生成的页面
  2. PHP教程之PHP调用session_start后页面始终加载的问题研究
  3. jQuery ajax调用不会调用我的php页面
  4. 使用安全的会话-cookie在HTTP和HTTPS页面之间切换
  5. php图片上传并重命名图片的功能实现原理
  6. php中csv导入的功能
  7. mySQL库编码,PHP页面编码和mysql_query("set names 'GBK'")编码问
  8. init-connectMysql对用户操作加审计功能
  9. mysql利用st_distance函数查询附近的点的功能

随机推荐

  1. 7.Android(安卓)自定义Loader
  2. Android(安卓)升级到android studio 2.2
  3. Android Support v4、v7、v13的区别和应
  4. Android4.4支持使用DevTools对原生Androi
  5. Android MediaStore数据之增删查改剖析
  6. 让Android中的webview支持页面中的文件上
  7. Android之——多线程下载示例
  8. Android倒计时Button
  9. Android的调试原理--学习笔记
  10. Windows Phone 7 不温不火学习之《ListBo