I am currently developing a GA reporting application for my company using asp.net Google api V3 ( Google.Apis.Analytics.v3.dll ). I understand that there is an older version of .net api and some example for it, but when there is a newer version, I can use it. This next piece of code is how you send a request for GA data using Google.GData.Analytics.dll . But this is an older version.
AnalyticsService _service = new AnalyticsService("GoogleAnalytics");
_service.setUserCredentials("YourUsername", "YourPassword");
DataQuery dataQuery = new DataQuery(Conststr_Url);
dataQuery.Ids = "ga:xxxxxx";
dataQuery.Dimensions = "ga:date";
dataQuery.Metrics = "ga:visits";
dataQuery.GAStartDate = "2012-05-10";
dataQuery.GAEndDate = "2012-05-24";
DataFeed visits = _service.Query(dataQuery);
foreach (DataEntry entry in visits.Entries)
{
Response.Write("Date: " + entry.Title.Text.Replace("ga:date=", "") + " Visits: " + entry.Metrics[0].Value + "<br />");
}
3 oauth2, Tasks.ASP.NET.SimpleOAuth2, . google, , . , , , :). - exmaple.
.