I'm using a Google Analytics API Class in PHP made by Doug Tan to retrieve Analytics data from a specific profile.
Check the url here: http://code.google.com/intl/nl/apis/analytics/docs/gdata/gdataArticlesCode.html
When you create a new instance of the class you can add the profile id, your google account + password, a daterange and whatever dimensions and metrics you want to pick up from analytics.
For example i want to see how many people visited my website from different country's in 2009.
//make a new instance from the class
$ga = new GoogleAnalytics($email,$password);
//website profile example id
$ga->setProfile('ga:4329539');
//date range
$ga->setDateRange('2010-02-01','2010-03-08');
//array to receive data from metrics and dimensions
$array = $ga->getReport(
array('dimensions'=>('ga:country'),
'metrics'=>('ga:visits'),
'sort'=>'-ga:visits'
)
);
Now you know how this API class works, i'd like to adress my problem.
Speed. It takes alot of time to retrieve multiple types of data from the analytics database, especially if you're building different arrays with different metrics/dimensions. How can i speed up this process?
Is it possible to store all the possible data in a cache so i am able to retrieve the data without loading it over and over again?