Click here to Skip to main content
15,868,141 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have written following code in a handler to get visitor count in asp.net website

C#
using Google.Analytics;
using Google.GData.Analytics; //v2.2.0.0

public class Visitor : IHttpHandler {

public void ProcessRequest (HttpContext context) {
    AccountQuery feedQuery = new AccountQuery();
    AnalyticsService service = new AnalyticsService("kiranaAnalytic");

    service.setUserCredentials("myemailid@gmail.com", "mypassword");

    DataQuery pageViewQuery = new DataQuery("https://www.google.com/analytics/feeds/data");//https://www.google.com/analytics/feeds/data
    pageViewQuery.Ids = "ga:xxxx";
    pageViewQuery.Metrics = "ga:visitors";
    pageViewQuery.GAStartDate = "2014-05-01";//DateTime.Now.AddMonths(-1).ToString("yyyy-MM-dd");
    pageViewQuery.GAEndDate = DateTime.Now.ToString("yyyy-MM-dd");
    DataEntry pvEntry = service.Query(pageViewQuery).Entries[0] as DataEntry;

    context.Response.ContentType = "text/plain";
    context.Response.Write(pvEntry.Metrics[0].Value);
}

public bool IsReusable {
    get {
        return false;
    }
}
}


It was working fine till yeaterday. But I am suddenly started getting following error. "Google.GData.Client.GDataRequestException: Execution of authentication request returned"

Has anyone have idea about it or did google made some changes ?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900