Javascript Google Analytics authentication problems

I want to track Google Analytics data in my Dashboard but I want a server-side authentication not a client side.

I found this login and tried to track my Data but it does not work really well... Usually I used something like this:

gapi.analytics.auth.authorize({
    clientId: 'XXXXXX',
    container: 'auth-button'
});
var viewSelector = new gapi.analytics.ViewSelector({
    container: 'view-selector-container'
});
viewSelector.execute();

var dataChart = new gapi.analytics.googleCharts.DataChart({
query: {
  metrics: 'ga:sessions',
  dimensions: 'ga:date',
  'start-date': '30daysAgo',
  'end-date': 'yesterday'
},
chart: {
  container: 'chart-container',
  type: 'LINE',
  options: {
    width: '100%'
     }
   }
});

Now my question is: how is it possible to mix those two scripts? How can I get access to google analytics data with server side authentication?

Thank you very much

链接地址: http://www.djcxy.com/p/47876.html

上一篇: 事件追踪,而无需在Google Analytics中创建目标

下一篇: Javascript Google Analytics身份验证问题