LoginSignup
9
9

More than 5 years have passed since last update.

Google Apps ScriptでGoogle アナリティクスのリアルタイムAPIを利用

Last updated at Posted at 2015-03-11

クラス名がわからなかったので備忘録を残す

参考

コードサンプル

function realTime() {
  var result = Analytics.Data.Realtime.get(
    reportConf_.gaInfo.viewId, // view id
    "rt:activeUsers", // 指標
    {
      'dimensions': 'rt:pagePath'
    }
  );
  var sheetRealtime_   = SpreadsheetApp.getActive().getSheetByName("realtime");
  var outputStartCell = sheetRealtime_.getRange("A1");
  for( var i = 0; i < result.rows.length; i++ ){
    outputStartCell.offset( i, 0, 1, 2 ).setValues( [ result.rows[i] ] );
  }
}
9
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
9