Here I am using asp.net web to display Google analytic data. I am successfully able to get access token using oauth2.0. Using access token I am also get account information.
在这里,我使用asp.net web来显示Google分析数据。我成功地使用oauth2.0获取访问令牌。使用访问令牌我也获得了帐户信息。
Here I want to get Google analytic data using access token. Please share link with me to get data using access token.
在这里,我想使用访问令牌获取Google分析数据。请与我分享链接以使用访问令牌获取数据。
I have seen following code
我见过以下代码
http://code.google.com/p/google-gdata/source/browse/trunk/clients/cs/samples/Analytics_DataFeed_Sample/dataFeed.cs
But don't want to use it because here I have to pass user name 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 access token.
让我知道使用访问令牌获取分析数据的任何方法。
2 个解决方案
#1
3
After long work will get success.....
经过长时间的工作将获得成功.....
Here is Oauth playground made by Google developer from you can test your data
这是由Google开发人员制作的Oauth游乐场,您可以测试您的数据
https://code.google.com/oauthplayground/
I just Oauth 2.0 for retrieve access token information after that I am using following URL for getting analytic information.
我只是Oauth 2.0用于检索访问令牌信息,之后我使用以下URL获取分析信息。
https://developers.google.com/analytics/devguides/reporting/core/v2/gdataReferenceDataFeed
you need to pass access token with your URL ie :
您需要使用您的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
Best of luck Enjoy coding..
祝你好运享受编码..
#2
0
You can try with following code
您可以尝试使用以下代码
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();
#1
3
After long work will get success.....
经过长时间的工作将获得成功.....
Here is Oauth playground made by Google developer from you can test your data
这是由Google开发人员制作的Oauth游乐场,您可以测试您的数据
https://code.google.com/oauthplayground/
I just Oauth 2.0 for retrieve access token information after that I am using following URL for getting analytic information.
我只是Oauth 2.0用于检索访问令牌信息,之后我使用以下URL获取分析信息。
https://developers.google.com/analytics/devguides/reporting/core/v2/gdataReferenceDataFeed
you need to pass access token with your URL ie :
您需要使用您的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
Best of luck Enjoy coding..
祝你好运享受编码..
#2
0
You can try with following code
您可以尝试使用以下代码
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();