编码在ASP.NET 4.0 /使用Javascript/jQuery的/ WebServices的是从谷歌分析数据导出API把数据
场景
需要我有Analytics帐户我已成立的客户端登录,比方说,[email protected]与密码pass123 我也知道了表的id,说GA:30037474
我的问题是我能拉数据,如
// Load the Google data JavaScript client library.
google.load('gdata', '2.x', { packages: ['analytics'] });
// Set the callback function when the library is ready.
google.setOnLoadCallback(init);
function init() {
myService = new google.gdata.analytics.AnalyticsService('charts_sample');
//how do i securely pull data without exposing my credentials if client login is a must
getDataFeed();
}
/**
* Main method to get report data from the Export API.
*/
function getDataFeed() {
myService = new google.gdata.analytics.AnalyticsService('charts_sample');
var myFeedUri = ['https://www.google.com/analytics/feeds/data',
'?start-date=2010-06-01',
'&end-date=2010-06-10',
'&dimensions=ga:day,ga:visitorType',
'&metrics=ga:visits',
'&sort=ga:day',
'&max-results=20',
'&ids=',
'ga:30037474'].join('');
myService.getDataFeed(myFeedUri, handleDataFeed, handleError);
}
或者我应该在此之前认证客户吗?
如果我需要对客户端进行身份验证,那么如果我得到关于如何处理这两个要求的指针会更好。
1.无法通过在客户端暴露用户凭据进行身份验证(需要类似web服务的东西)
2.当我的站点加载时,它应该加载分析数据(不应要求登录然后在那里拉取分析数据)。
是否有任何地方的文章?
http://stackoverflow.com/questions/2374032/embeddable-google-analytics-flair – 2011-01-07 13:56:15