10月から引き続きAngularJSな日々を送っている先生です。 今回はAngularJSで作ったシングルページアプリケーション(以下SPA)をGoogle Analyticsでトラッキングさせたいと思います。 SPAでのトラッキング問題 Google Analyticsは、タグを埋め込むだけで勝手にトラッキングしてくれる手軽な解析ツールです。しかしAjaxやpushStateなどページ遷移を伴わないSPAでは、トップページしか解析されません。Analyticsではその対策として、任意のタイミングでトラッキングすることができる仕組みを持っています。 // ページビュー ga('send', 'pageview'); // イベントトラッキング ga('send', 'event', 'image1', 'clicked'); 参考:高度な設定 – ウェブ トラッキング(analytics.