ちょっとGoogle AnalyticsのWebだとやりにくいアクセス集計がやりたくて、Analytics APIを叩いてみました。以前Google CalendarのAPIを使った事があるので大丈夫かと思ったら、結構手間取ったので記録しておきます。 まずコードを書く前に準備が必要です Google APIコンソールでAnalytics APIを有効にする Google APIコンソールからclient_secrets.jsonをダウンロードしておく それで何に手間取ったかというと、Analytics APIにはCollectionとConfigurationとReportingの3つの機能があるのですが、訪問数とかページビューとか取得するのがCollectionだと思い込んでいて、中々機能が見つかりませんでした。欲しい機能はReportingでした。なおドキュメントはコチラ。 それでコー