I have been using the Google.GData.Analytics
and Google.GData.Client
to retrieve some Google Analytics data though the Google Analytics API v2 in my web application.
The code was as follows:
string username = "abc@gmail.com";
string password = "myPasswordHere";
string profileId = "ga:88376970";
string _from = Convert.ToDateTime(dtpFrom.SelectedDate.Value.ToString()).ToString("yyyy-MM-dd");
string _to = Convert.ToDateTime(dtpTo.SelectedDate.Value.ToString()).ToString("yyyy-MM-dd");
AccountQuery AccountsQuery = new AccountQuery();
service = new AnalyticsService("DoogalAnalytics");
service.setUserCredentials(username, password);
try
{
DataFeedUrl = "https://www.google.com/analytics/feeds/data";
DataQuery PageViewQuery = new DataQuery(DataFeedUrl)
{
Ids = profileId ,
Metrics = "ga:pageviews",
Dimensions = "ga:date",
Sort = "ga:date",
GAStartDate = _from,
GAEndDate = _to
};
StringBuilder strData = new StringBuilder();
int maxValue = 0;
int today = 0;
List<int> gList = new List<int>();
foreach (DataEntry entry in service.Query(PageViewQuery).Entries)
{
var value = entry.Metrics.First().IntegerValue;
gList.Add(value);
maxValue = value > maxValue ? value : maxValue;
today = entry.Metrics.Last().IntegerValue;
strData.AppendFormat("{0},", value);
}
}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
This code was working perfectly fine until about 5 days ago and I have been using this code for the last 7 or 8 months, but now suddenly I am facing the error
Execution of authentication request returned unexpected result: 404.
When I searched google. I have searched alot but could not find any solution. Any help or guidance will be greatly appreciated.