alexn
alexn

Reputation: 58962

Google Analytics Data API [C# Design]

I'm currently building a library around the Google Analytics Data Export API.

When i'm requesting data for a specific profile, this is the response from Google:

<entry>
    <id>http://www.google.com/analytics/feeds/data?ids=ga:3104565&amp;ga:browser=Firefox&amp;start-date=2008-07-10&amp;end-date=2008-08-10</id>
    <updated>2008-08-09T17:00:00.001-07:00</updated>
    <title type='text'>ga:browser=Firefox</title>
    <link rel='alternate' type='text/html' href='http://www.google.com/analytics'/>
    <dxp:dimension name='ga:browser' value='Firefox'/>
    <dxp:metric confidenceInterval='0.0' name='ga:pageviews' type='integer' value='17547'/>
</entry>

What would be the most logic to return? How would you want to work with the returned data? I have a Entry-object with all the above elements.

The signature for the method is:

public object GetProfileData(int profileId, IEnumerable<Metric> metrics, IEnumerable<Dimension> dimensions, DateTime start, DateTime stop)

Where Metric and Dimension is Enums.

Well, this is actually language agnostic.

If you need any more details, don't hesitate to comment.

Upvotes: 0

Views: 2653

Answers (2)

Stobor
Stobor

Reputation: 45122

An obvious source of inspiration would be the Google Analytics Java Data Export API, as it would be making a similar mapping to what you're aiming for. (XML-to-Java-objects is similar to XML-to-C#-Objects...)

See also this question: Google Analytics API and .Net and code here: http://google-gdata.googlecode.com/svn/trunk/clients/cs/src/analytics/

Upvotes: 1

Brad Gignac
Brad Gignac

Reputation: 819

I imagine I'd like having a C# object returned - maybe of type GData or something similar. It could include an integer for the profileId, and DateTimes for the data range. The actual data (pageviews from Firefox?) is a little bit trickier since I have limited experience using the API. How about a Dictionary using the metric as the value and the dimension as the key?

Upvotes: 0

Related Questions