Retrieve Google Analytics data using Oauth token?

Here I use the asp.net website to display Google analytic data. I can successfully get the access token using oauth2.0. Using the access token, I also get account information.

Here I want to get Google analytic data using an access token. Share the link with me to receive data using an access token.

I saw the following code

http://code.google.com/p/google-gdata/source/browse/trunk/clients/cs/samples/Analytics_DataFeed_Sample/dataFeed.cs

But I do not want to use it, because here I need to transfer the username and password:

 private const String CLIENT_USERNAME = "INSERT_LOGIN_EMAIL_HERE";
 private const String CLIENT_PASS = "INSERT_PASSWORD_HERE";

Let me know any way to get analytic data using an access token.

+5
source share
2

.....

Oauth, Google, .

https://code.google.com/oauthplayground/

Oauth 2.0 , URL .

https://developers.google.com/analytics/devguides/reporting/core/v2/gdataReferenceDataFeed

URL-, :

https://www.googleapis.com/analytics/v2.4/data?ids=ga:12345&metrics=ga:visitors,ga:bounces&start-date=2012-07-01&end-date=2012-07-25&access_token=ya29.AHES6ZTzNR6n6FVcmY8uar6izjP9UGeHYNO5nUR7yU2bBqM

..

+3

string ClientId = "CLIENTID"
string ClientSecret = "CLIENTSECRET"
var Client = new NativeApplicationClient(GoogleAuthenticationServer.Description, ClientId, ClientSecret);
var Auth = new OAuth2Authenticator<NativeApplicationClient>(Client, Authenticate);

var Service = new AnalyticsService(Auth);

var Request = Service.Data.Ga.Get("profileID", StartDate, EndDate, "Matrix");
Request.MaxResults = 1000;
Request.Dimensions = "Dimensions";

var Result = Request.Fetch();
0

All Articles