4

PHPのGoogleアナリティクスで検索概要を表示する方法??

Google アナリティクスのページが表示されました

訪問数 76

この機能を使用していますga:organicSearchesリンクはここdevelopers.google.com/analytics/devguides/reporting/core です

このデータを新しい分析 Web サイト内に表示したいのですが、この関数では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 />';

このデータを表示する他の機能はありますか???

ありがとう

4

1 に答える 1

1

オーガニック検索結果 (検索エンジンからの有料訪問) を取得するために使用するパラメーターは次のとおりです。

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

「filters」行に注意してください。その値は'ga:medium==organic'に設定されています。

これにより、オーガニック トラフィックの訪問が返されます。有料の別の呼び出しを行って、Google アナリティクス ウェブ アプリの検索概要ページを複製できます。

于 2012-11-27T09:47:44.867 に答える