I’ve been trying to retrieve Google analytics reports using their provided .NET api and have really been scratching my head over how I actually retrieve anything using the newest version, v3, which is available here: http://code.google.com/apis/analytics/docs/gdata/v3/gdataLibraries.html
For example, I’d like to retrieve a report query like this one: https://www.google.com/analytics/feeds/data?dimensions=ga:browser&end-date=2012-01-25&ids=ga:ACCOUNTID&metrics=ga:visits&start-date=2011-12-25
I’m able to return reports just fine using version 2 which uses GData, but was hoping to get version 3 going in case version 2 was deprecated, but having a lot of trouble seeing as meaningful documentation seems to be outdated or non-existant and I haven’t been able to find any examples.
We’ve just updated our analytics service to use v3.0 of the API as v2.3 is now deprecated, there is a migration guide on google https://developers.google.com/analytics/resources/articles/gdata-migration-guide which might help.
I tried using the google dotnet API http://code.google.com/p/google-api-dotnet-client/ which supports v3 but gave up as there is a lack of documentation and samples. We’re calling the api through a net.httpwebrequest which was easier than trying to work out what’s going on in the API.
For v3 your call should be to
https://www.googleapis.com/analytics/v3/data/ga?dimensions=ga:browser&end-date=2012-01-25&ids=ga:ACCOUNTID&metrics=ga:visits&start-date=2011-12-25