> You are exactly right, and appear to have a perfectly good PHP api
> class. I guess that is typical for PHP, with everyone trying to reinvent
> the wheel.

It sure is typical with PHP :)  There's already a few listed here already:
http://code.google.com/apis/analytics/docs/gdata/gdataDeveloperLibraries.html

> I will be adding the parsing shortly. I wonder though, it appears that
> your class doesn't give out the metrics for the entire table - like
> total pageviews, total visits, I guess you could calculate this by
> summing up the results.

You're better not to sum up the results because if you haven't
actually got all the data (e.g. you limit it to N results, or there's
more than 1000 rows) then it won't be accurate. However you can get
the data for a metric without specifying a dimension which gives you
the total for the defined period. e.g. you could do this with my
class:

$data = $api->data($id, '',
'ga:bounces,ga:newVisits,ga:visits,ga:pageviews,ga:uniquePageviews');
and it would return something like this:

Array
(
    [ga:bounces] => 80450
    [ga:newVisits] => 78065
    [ga:visits] => 91269
    [ga:pageviews] => 111897
    [ga:uniquePageviews] => 101575
)

> I am planning on having all of the metrics data returned as objects
> (with 'get' functions), kind of like an ORM for the XML. I was inspired
> by the ORM interfaces like doctrine and prototype and how easy it is to
> work with this data, including related data.

Sounds like a good idea.

Cheers,
Chris

-- 
Chris Hope
The Electric Toolbox Ltd

Email: [email protected]
Web: www.electrictoolbox.com
Phone: +64 9 522 9531
Mobile: +64 21 866 529

--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]
-~----------~----~----~----~------~----~------~--~---

Reply via email to