How to show google analytics search overview in php ??
Google Analytics Page Shown
Visits 76
I use this function ga: organicSearches link here developers.google.com/analytics/devguides/reporting/core
I want to show this data on my new analytics website, but this feature shows me 74 visits
May I find out where I am going wrong.
Here is my code: -
$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 display this data ???
thanks
source share